sketchucation logo sketchucation
    • Login
    1. Home
    2. voljanko
    3. Posts
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    πŸ›£οΈ Road Profile Builder | Generate roads, curbs and pavements easily Download
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 22
    • Posts 142
    • Groups 2

    Posts

    Recent Best Controversial
    • RE: Bug Splat on erase!

      @thomthom said:

      Mat I ask what your temp group do? What is it function?

      Im using it to highlight some surfaces ,because I can draw only lines (and points and text) with view.draw.

      Is there any samples of using the ModelObserver.onTransactionCommit and other onTransaction functions?
      I cannot figured out what are they for.

      posted in Developers' Forum
      voljankoV
      voljanko
    • RE: Bug Splat on erase!

      I have a group that is generated when a tool is activated and deleted when a tool is deactivated.
      The problem is when the model is saved when a tool is active (auto save or user save).
      I don't want that group to be saved in the model,so I have implemented the onPreSaveModel observer to delete the group.
      But I cannot get rid of the BugSplat.

      posted in Developers' Forum
      voljankoV
      voljanko
    • RE: Bug Splat on erase!

      Uff,your solution didn't resolved the problem(same result),but helped to understand it.
      It seems that the onPreSaveModel observer is not the real pre save observer.I would need a pre-pre save observer. πŸ˜„

      posted in Developers' Forum
      voljankoV
      voljanko
    • Bug Splat on erase!

      Hello.
      I want to erase some geometry before saving a model,so I use the onPreSaveModel observer to do this.
      Erasing is executed correctly,but after it the Bug Splat screen is happening.
      I would like to find a way to do it without Bug Splat screen.
      Here is the code,just select one item and it will be erased before saving the model.

      class MyModelObserver1 < Sketchup;;ModelObserver
      	def onPreSaveModel(model)
      		selection = Sketchup.active_model.selection
      		selection[0].erase!
      	end
      end
       
      Sketchup.active_model.add_observer(MyModelObserver1.new)
       
      class MyAppObserver1 < Sketchup;;AppObserver
      	def onNewModel(model)
      		Sketchup.active_model.add_observer(MyModelObserver1.new)
      	end
      	   
      	def onOpenModel(model)
      		Sketchup.active_model.add_observer(MyModelObserver1.new)
      	end
      end
      
      Sketchup.add_observer(MyAppObserver1.new)  
      
      posted in Developers' Forum
      voljankoV
      voljanko
    • RE: Model observer problem

      Yes,I have thought about this right after sending my post,but want to test first.
      Now it is working ok and sorry for blaming observer for this problem.
      So this is the working code:

      class MyModelObserver < Sketchup;;ModelObserver
      	def onPreSaveModel(model)
      		UI.messagebox("onPreSaveModel; " + model.to_s)
      	end
      end
       # Attach the observer.
      Sketchup.active_model.add_observer(MyModelObserver.new)
       
      class MyAppObserver < Sketchup;;AppObserver
      	def onNewModel(model)
      		UI.messagebox("onNewModel; " + model.to_s)
      		Sketchup.active_model.add_observer(MyModelObserver.new)
      		# Here is where one might attach other observers to the new model.
      	end
      	   
      	def onOpenModel(model)
      		UI.messagebox("onOpenModel; " + model.to_s)
      		Sketchup.active_model.add_observer(MyModelObserver.new)
      		# Here is where one might attach other observers to the new model.
      	end
      end
      
      # Attach the observer
      Sketchup.add_observer(MyAppObserver.new)
      
      posted in Developers' Forum
      voljankoV
      voljanko
    • Model observer problem

      I need to implement the onPreSaveModel observer,and according the http://www.thomthom.net/software/sketchup/observers/
      ,it should work in SU version 8.
      But according to my testing,the observer works only on the new model.If I close and open again the SU program,the observer is not trigged anymore.My code is simple copied from the API:

      class MyModelObserver < Sketchup;;ModelObserver
      	def onPreSaveModel(model)
      		UI.messagebox("onPreSaveModel; " + model.to_s)
      	end
      end
       # Attach the observer.
       Sketchup.active_model.add_observer(MyModelObserver.new)
      

      Please somebody test it,and if confirmed,I will not touch observers anymore. 😞

      posted in Developers' Forum
      voljankoV
      voljanko
    • RE: Parent instance of a component

      My intention was to write and read some attributes to some groups and components.
      After writing it to components (instances) ,it was impossible to read the attribute of the parent component(or group).
      To resolve it,I have decide to write and read only to definitions of the components.
      Now,before I write or read to entities, I check if the entity is group or component.
      If it is a group,I read and write to this entity,if it is a component,I read and write to the definition of this component.In this way,I don't need to know the exact parent instance of the component,because all the instances have the same attributes.
      So the problem is resolved πŸ˜„

      posted in Developers' Forum
      voljankoV
      voljanko
    • RE: Parent instance of a component

      The problem is not with the shape of components but with attributes.

      If I assign the attribute to instance,will not copied to all instances and make the instance unique (in attribute only).
      So the right assignment of the attributes should be to definitions,not to instances.And then,the instances will be all the same and happy consistent.πŸ˜„

      posted in Developers' Forum
      voljankoV
      voljanko
    • RE: Parent instance of a component

      @tig said:

      Dynamic components are an exception to the rule..

      But isn't it that from the version 7 of Sketchup,every component is Dynamic?

      posted in Developers' Forum
      voljankoV
      voljanko
    • RE: Parent instance of a component

      Dan,your thinking makes sense,but reality is different.
      I have tested the parentInstance = subComponent.parent.instances[0]
      and is giving me the right instance like Aerilius writes.

      The problem is that if I give an attribute (using Ruby) to one instance,it is not copied to all instances,if I assign it in dynamic components window,it is copied to all instances.So the instances are not always the same.

      posted in Developers' Forum
      voljankoV
      voljanko
    • RE: Parent instance of a component

      This is kind of a strange,because each instance can have different name ,attributes,ID ...
      Mostly I'm interested in changing attributes,but I need to know to "who" πŸ˜„

      posted in Developers' Forum
      voljankoV
      voljanko
    • Parent instance of a component

      Hello.
      I have a subcomponent in a component instance and trying to have a handle on a parent of the subcomponent.But if I do the
      subcomponent.parent , I have a handle on a component definition.But I want the handle on a right component instance.

      How to do that?

      posted in Developers' Forum
      voljankoV
      voljanko
    • RE: Strange result of a substraction

      Try to add some number,you will see that is zero and not 4.

      posted in Developers' Forum
      voljankoV
      voljanko
    • RE: Strange result of a substraction

      @unknownuser said:

      i dont compare anything !!!
      i have tested with a = a + b the result is same

      I just meant that is always good to avoid considering floats as exact numbers.

      posted in Developers' Forum
      voljankoV
      voljanko
    • RE: Strange result of a substraction

      This is almost zero πŸ˜„
      It is always a risk when you use floats, in all languages.You should never compare float == float if you don't want problems.

      posted in Developers' Forum
      voljankoV
      voljanko
    • RE: How to detect the closed body?

      Ok,I like this definition:If all the edges in the geometry have 2 faces ,it is a solid.
      Maybe I have complicated a little 😳

      posted in Developers' Forum
      voljankoV
      voljanko
    • RE: How to detect the closed body?

      Thank Pilou.
      I have fount this interesting in the Solid Inspector plugin:# Any edge without two faces means an error in the surface of the solid.

      But this is not enough to detect a potential solid, because not all edges with two faces means the solid.
      There is still a definition missing,what combination of edges and faces makes a solid.
      Any tips?
      The award will be a useful and free plugin πŸ˜„

      posted in Developers' Forum
      voljankoV
      voljanko
    • How to detect the closed body?

      I would like to detect if a body is closed,so all the faces are connected.For example,if I check the cube with additional unconnected line or face,I should detect the cube.So how to loop faces and edges to find that the body has no holes?
      Thanks.

      posted in Developers' Forum
      voljankoV
      voljanko
    • RE: [Plugin] Solids Penetration Check

      Yes,there is a way,why are you asking πŸ˜„
      Anyway,if you want to find the mistakes,that makes your group a non-solid,there is another plugin - Solid Inspector from thomthom.

      posted in Plugins
      voljankoV
      voljanko
    • RE: [Plugin] Solids Penetration Check

      Thank you thomthom for your suggestions.
      I have test the plugin on a model with 31 solids organised in many subgroups and it takes 40 seconds to
      find 10 "penetrations".So it is slow and need some speed-up like you suggest.

      posted in Plugins
      voljankoV
      voljanko
    • 1 / 1