sketchucation logo sketchucation
    • Login
    1. Home
    2. AlexMozg
    3. Posts
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    A
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 11
    • Posts 66
    • Groups 2

    Posts

    Recent Best Controversial
    • RE: [Plugin] #SelectionHideShow.rb v1.1

      TIG
      ❓ Why constantly to use the method of group_miner, when in him practically is not there a necessity?
      ❓ Why to apply properties to entity, when are new properties of entity equal to the applied properties?
      These questions are linked at a speed of implementation of script on the large scenes.

      ❗ Example of considerable increase of speed of implementation of script:

      
      class Sketchup;;Group
          def definition
              self.entities.parent
          end
      end
      def SelectionTool;;group_miner(ents)
          ents.each do |e|
              if e.is_a? Sketchup;;Group
                  e.make_unique if e.definition.instances.length > 1
                  SelectionTool;;group_miner(e.entities)
              end
          end
      end
      
      

      ❗ At the use of method of typename speed of implementation of script goes down in once or twice!
      It would be desirable to correct these shortages...

      posted in Plugins
      A
      AlexMozg
    • [Code] Method Model.start_operation for SketchUp 5-6

      Let me introduce you the following idea of the compatibility of the 'start_operation' method of Sketchup 7 with 4 arguments and 'start_operation' method of the earlier Sketchup versions with 1 argument.

      
      if Sketchup.version_number < 7000000
        class Sketchup;;Model
          alias ;old_start_operation ;start_operation
          def start_operation(*args)
              old_start_operation args.at(0)
          end#def
          private ;old_start_operation
        end#class
      end#if
      
      

      Now the 'start_operation' method of the earlier Sketchup versions takes on any number of arguments.
      How do you like this method?
      ❓ ❓ ❓

      posted in Developers' Forum
      A
      AlexMozg
    • [Plugin] Extended Standard Views - ArchTools-version!

      My variant of script of published before Chris Fullmer.
      (http://www.sketchucation.com/forums/scf/viewtopic.php?f=180&t=19168)
      A difference is more correct code, to my mind.
      Includes: Iso Auto, Iso SW, Iso SE, Iso NE, Iso NW
      (Iso SW, Iso SE, Iso NE, Iso NW - only in menu)
      NOTE: Only correct works with SketchUp version 7
      It is the cut out part from my complex of plugins.
      Use and enjoy. 😉


      AT_set_standard_views_toolbar.png


      Extended Standard Views(ArchTools version)

      posted in Plugins
      A
      AlexMozg
    • RE: [Plugin] Extended Views v1.2 UPDATE May 23, 2013

      Chris, I will make icons and will correct my version of plugin in the near time.

      posted in Plugins
      A
      AlexMozg
    • RE: [Plugin] Extended Views v1.2 UPDATE May 23, 2013

      I develop the large complex of plugins ArchTools.
      But while not all is ready for a publication.
      And I wrote a similar plugin also.
      But while did not find how to avoid improper work of plugin in more early versions of Sketchup.
      I publish my variant of script, because I think the best version of my script.
      (Includes Iso Auto, Iso SW, Iso SE, Iso NE, Iso NW)
      It is the cut out part from my complex of plugins.
      Unfortunately without icons.
      😞


      Extended Standard Views(ArchTools version)

      posted in Plugins
      A
      AlexMozg
    • What are the differences between __send__ and send?

      What is the difference between the methods send and send?
      Both methods work identically, to my mind.
      What method preferably to use?
      ❓ ❓ ❓

      posted in Developers' Forum
      A
      AlexMozg
    • RE: [Code] ComponentInstance-add_entities v1.9

      Method 'group.definition'....
      More correct would be the code:

      
      class Sketchup;;Group
         def definition
            self.entities.parent
         end
      end
      
      

      Because, when group is empty
      there is an error at the use of code: self.entities[0.parent]
      The group may be empty soon after its inception.
      For example:

      group = Sketchup.active_model.active_entities.add_group
      definition = group.definition
      

      Request to replace a code on more correct, because I use this method in the developments.
      ❗

      posted in Developers' Forum
      A
      AlexMozg
    • RE: [code] ComponentDefinition-delete (another version!)

      You can use a not method (ComponentDefinition.delete), but idea:

      definition.entities.erase_entities definition.entities.to_a
      

      between
      model.start_operation ("")
      and
      model.commit_operation

      Sometimes so simpler...

      posted in Developers' Forum
      A
      AlexMozg
    • RE: [code] ComponentDefinition-delete (another version!)

      Bugsplat also can be at the use of method of "erase!" between "start_operation" and "commit_operation".

      posted in Developers' Forum
      A
      AlexMozg
    • RE: [code] ComponentDefinition-delete (another version!)

      @thomthom said:

      But when I implement it into my working plugin, the component remains in the browser and will bugsplat if I try to place it... hm...

      Therefore I foresaw additional possibility of the use of this method.
      Use this method with the argument false, if you do not want to begin a new operation and correct forming "undo".
      Essence consists in correct determination of start [ start_operation ]
      and end [ commit_operation ] of operation!
      It most important, bugsplat is otherwise possible!

      
      def my_new_plugin
         model = Sketchup.active_model
         model.start_operation "New Operation"
         definitions = model.definitions
      #....................................
      #....................................
      #....................................
         definitions[0].delete(false) if definitions.to_a[0]
         definitions[1].delete(false) if definitions.to_a[1]
         definitions[2].delete(false) if definitions.to_a[2]
      #....................................
      #....................................
      #....................................
         model.commit_operation
      end
      
      

      If I understood correctly...

      P.S
      When I tested, bugsplat repeated oneself too often... 😞
      I maximally tried to foresee all possibilities of bugsplat appearance and prevent them.

      By the way, my example at the end of file "AT-ComponentDefinition-delete.rb" it is possible to delete or comment out if he will not be used.

      posted in Developers' Forum
      A
      AlexMozg
    • [code] ComponentDefinition-delete (another version!)

      This script adds a new method for a Sketchup::ComponentDefinition class.
      component_definition.delete
      This is another version different from the version published previously.
      The method is implemented for Sketchup versions 5-7.
      In Sketchup version 7 provided the most complete functionality.
      Method is faster, because the method "purge_unused" is not used.
      Test and enjoy! 😄

      At the end of the file a small example of use.


      TIG version: http://www.sketchucation.com/forums/scf/viewtopic.php?f=180&t=17962


      AT-ComponentDefinition-delete.rb

      posted in Developers' Forum
      A
      AlexMozg
    • RE: Manipulating the InputPoint

      I so strongly wanted it...
      And it has appeared so simply!

      
      module Sketchup
        class InputPoint
          def position=(pt)
            self.copy! InputPoint.new(pt)
          end
        end
      end
      
      

      And it works and with arrays

      
      a=Geom;;Point3d.new(1,2,3)
      p=Sketchup;;InputPoint.new(a)
      p.position=Geom;;Point3d.new(10,20,30)
      #or
      p.position=[10,20,30]
      
      

      😄
      Whether it is necessary now?

      Didier Thank you!
      👍

      posted in Developers' Forum
      A
      AlexMozg
    • RE: Coming Soon:Profile Builder

      I have very much become interested in test.
      Thanks! 👍

      posted in Developers' Forum
      A
      AlexMozg
    • RE: How to pause a ruby script for 1 second

      @unknownuser said:

      Yes, rid from selection …

      … but how? This way?

      
      def select_comp_by_name(comp_name)
         model = Sketchup.active_model
         if compdef = Sketchup.active_model.definitions[comp_name]
            sel = compdef.instances
         else
            sel=[]
            Sketchup.active_model.active_entities.each do |d|
               if d.typename == "ComponentInstance"
               sel << d if d.name==comp_name
            end
         end
            if sel.count == 0
               UI.beep
            else
               UI.messagebox(sel.count.to_s + " gesuchte Dinger gefunden.")
            end
         end
      sel
      end
      
      def Morisdov.transf_get(dict_key, ss=nil)
        model=Sketchup.active_model               
        ents=model.active_entities
         if ss
           @ents = ss
         else
           @ents=[]
           model.selection.each {|e| @ents.push(e)}
         end                                 
        @ents.freeze
        model.selection.clear
        ...
        ...<<original code>>...
        ...
      end
      
      
      
      
      

      Use:

      1. ss = select_comp_by_name("Fahrstuhl")
      2. Morisdov.transf_get(dict_key, ss)

      @unknownuser said:

      (my poor english) Which "following.rbs" you need?

      Here this:

      @unknownuser said:

      ...Position 2
      To get the script work, the following .rbs must be installed:

      ????

      posted in Developers' Forum
      A
      AlexMozg
    • RE: How to pause a ruby script for 1 second

      @unknownuser said:

      My question is, how to select the "Fahrstuhl/elevator" without selection marks.

      The simplest - to make changes to a script "Morisdov".
      Somehow here so:

      
      def Morisdov.transf_get(dict_key, ss=nil)
        model=Sketchup.active_model					
        ents=model.active_entities
         if ss
           @ents = ss
         else
           @ents=[]
           model.selection.each {|e| @ents.push(e)}
         end											
        @ents.freeze
        model.selection.clear
      ....
      ....
      end
      
      

      And completely to get rid from selection.

      Where I can find "following.rbs"?
      I shall think...

      posted in Developers' Forum
      A
      AlexMozg
    • RE: How to pause a ruby script for 1 second

      @n lindenthal said:

      ...
      I think I have to ask Morisdov by PM.

      Ask me, and I shall try to answer.

      posted in Developers' Forum
      A
      AlexMozg
    • RE: How to pause a ruby script for 1 second

      And it is possible and so:

      
      ...
      ...
      def self.timer(proc, time_limit=0.5)
      $val_time = Time.now
      $timer = UI.start_timer(0, true) do
         if Time.now - $val_time >= time_limit
            UI.stop_timer $timer
            proc.call
            $val_time = $timer = nil
         end
      end
      end
      ...
      select_comp_by_name("Fahrstuhl")
      Morisdov.transf_get("transf2")
      self.timer(proc{Sketchup.active_model.selection.clear})
      ...
      
      
      

      Though it is possible to do without global variables.
      But, I do not know that Morisdov.transf_get does.
      ;

      posted in Developers' Forum
      A
      AlexMozg
    • RE: How to pause a ruby script for 1 second

      Here such variant:

      
      time_limit = 0.2
      @val_time = Time.now
      @timer = UI.start_timer(0, true) do
      	if Time.now - @val_time >= time_limit
      		UI.stop_timer @timer
      		Sketchup.active_model.selection.clear
      		@val_time = @timer = nil
      	end
      end
      
      
      

      It works 😄

      posted in Developers' Forum
      A
      AlexMozg
    • RE: How to receive correct coordinates of all vertexes?

      Correctly it will be whew:

      
      ...
      @lines = []
      extract_lines(group.entities, group.transformation)#!!!
      ...
      def extract_lines(ents, tr)
         ents.each do |e|
            if e.typename == "Edge"
                  line = [e.vertices[0].position, e.vertices[1].position]
                  line[0] = tr * line[0]
                  line[1] = tr * line[1]
                  @lines << line
            elsif e.typename == "Group"
               extract_lines(e.entities, (tr * e.transformation))##!!!
            elsif e.typename == "ComponentInstance"
               extract_lines(e.definition.entities, (tr * e.transformation))#!!!
            end
         end
      end
      
      

      and it works!
      😍

      posted in Developers' Forum
      A
      AlexMozg
    • RE: Question about Static Text, thx!

      It is done very simply:

      
      model = Sketchup.active_model
      note = model.add_note "Test", 0.1, 0.1
      
      

      http://groups.google.com/group/SketchUp-Plugins-Dev/web/Ruby-Model.html#add_note

      posted in Developers' Forum
      A
      AlexMozg
    • 1 / 1