sketchucation logo sketchucation
    • Login
    1. Home
    2. existme
    โ„น๏ธ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 4
    • Groups 1

    existme

    @existme

    10
    Reputation
    1
    Profile views
    4
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online
    Age 47

    existme Unfollow Follow
    registered-users

    Latest posts made by existme

    • RE: Glued_to problem

      Thanks so much ๐Ÿ˜„ It's a pity that you cannot glue to other component's faces via API.

      posted in Developers' Forum
      existmeE
      existme
    • RE: Glued_to problem

      @tig said:

      You can only glue an instance onto a face that is in the same context as the instance.
      Although you have not given all of, or clearly explained your code... here goes...

      Thanks a lot for your quick reply. I thought may be putting all the code here would be irrelevant as long as functional description is known. findPartByName seeks through a component which is made of other components to return an instance by name

      [pre:17k1x45e]def findPartByName(entity, name) res=nil if (entity.is_a? Sketchup::Group) return entity if(entity.name==name) entity.entities.each{|e| res = findPartByName(e,name);return res if res!=nil;} elsif (entity.is_a? Sketchup::ComponentInstance) return entity if(entity.name==name) entity.definition.entities.each{|e| res = findPartByName(e,name);return res if res!=nil;} end return res end[/pre:17k1x45e]

      I have turned the face into a group in the mount component so I can find it by name and I have double checked that it is the correct face. The transformations is a little bit complex but anyway it is correct. I mean the camera will be placed exactly on the face that I need to align to it. The only problem is that I need to glue them together. I know it is possible (maybe with some tricks) because when you place the camera manually on that face, it will be glued to it.

      I cannot make them a unique component because each of them has different property sheets and I don't want to force users to open the component and view the property sheet.
      I've attached some pictures maybe they help to understand the problem.

      http://s22.postimg.org/umt9oiwsx/cam_mount.jpg

      http://s22.postimg.org/oxd147qmp/cam_mount2.jpg

      /Reza

      posted in Developers' Forum
      existmeE
      existme
    • Glued_to problem

      I am developing a set of camera toolbox for Sketchup. I have separate mount models and camera models. I need to have a functionality to automatically attach camera models on mount models. I exactly align camera models to the surface of the mount and put it on the center of the face.

      Problem:
      I use the following code:

      camera_instance = Sketchup.active_model.entities.add_instance componentdefinition, t glueto_face = findPartByName(mount_comp, "GlueTo") # find the face to attach camera_instance.glued_to = gluedto_face

      But Sketchup raises an error that:
      Can only glue to something in the same component

      I know that it is possible to glue_to a face of another component because when I manually insert component from UI, the camera.glued_to is set to the instance of the mount. I wonder how to do it through Ruby.

      Any help would be appreciated.

      posted in Developers' Forum
      existmeE
      existme
    • RE: Get attribute roty

      I wonder if you had find an answer to your problem, I also need to know the value of lenY but I cannot get it through get_attribute with out entering them manually in dc panel

      posted in Developers' Forum
      existmeE
      existme