Thanks so much It's a pity that you cannot glue to other component's faces via API.
Latest posts made by existme
-
RE: Glued_to problem
-
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./Reza
-
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 componentI 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.
-
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