Componant axes
-
Hi all,
He's there someone who have a simple method to retrieve the x,y,z of a 3D point in a group or in a componant according to the axes of the model ?
thanks -
Is the component open or closed when you get your 3d point information? SU transforms the open component/group into world coordinates.
-
Otherwise... you know the container's transformation and you can apply that to the point in the group to give 'world' coordinates... If things are nested you'll need to applying each context's transformation to get back to the base model's coordinates...
There are also methods likegroup.transformation.origin
to give the group's insertion point in its current context (but [0,0,0] in the group itself)... -
Thanks for yours answer.
Because of my english I'm not sure of youre answer.
My plugin make an array of all edges in the model including edges inside group and componant. for each edge it find coordinates of strat and end point od edge. But for edge inside group and componant ".position" give me the local coordinate. And I want global coordinate.
Thomthom solution: I need to open the group or componant to retrive is coordinate
TIG solution: I should use the componentinstance.transformation and apply transformation to the point.position.I finaly apply TIG solution and it's works . Thanks.
-
Hey,
i want to load 2 - 4 components in SU.
My Problem:
How can i put these componets together, without hardcoding the coordinates?For example:
I want to set a driller on a cuboid, then i need the coordinates of
the edges to know how big the components are, right?
Unfortunately i don't know any method to retrieve these valuesOr is there another way to avoid the hardcoded way?
Greets
-
You add the components - each as a new definition, to the model.definitions list.
Then use say model.active_entities.add_instance(definition, transformation).
The 'transformation' is premade by you to locate the instance where you want - it can also include rotations, scaling etc...
You can also use instance.transform!(tr) later to change the location or rotation of an existing instance.
If you know the sizes of the various component it's easy enough to locate them all relative to one another.
Alternatively, if the inserted instances' relationships are always the same, then why not make single SKP with the various components already manually arranged as desired and then load that, place an instance of it and explode it so the 'loose' components are place as desired... -
Thanks a lot for your answer,
Mayby i'm wrong,
but i believe, you misunderstand me.so i show you what i've programmed:
` driller= Sketchup.active_model.definitions.load("\driller.skp")
pos_driller = Geom::Point3d.new 47,32,25
set_driller= Geom::Transformation.new pos_driller
instance1 = entities.add_instance driller, set_drillercuboid_wood = Sketchup.active_model.definitions.load("\Cuboid_wood.skp")
pos_cuboid = Geom::Point3d.new 0,0,0
set_cuboid = Geom::Transformation.new pos_cuboid
instance2 = entities.add_instance cuboid_wood, set_cuboid`but this is hardcoded
and i want that the computer places the objects correctly together automatically,by calculating the best position, but i can't calculate the size of these objects, because i don't know how. (i would have to measure the size with the measure-tool in SU with the mouse, but it should retrieve the values with a method)I have the task to do that with many components, that's why i wouldn't
say the detailed coordinates for every components, which i load.the programm should be able to load componentes, put it together correctly and dynamically, take some photos in different perspectives, save these pictures, clear it all and start at the beginning with other components ... everthing is quite clear to me, with the exception of the hardcoded coordinates of these objects
P.S.
i have wrote this problem in a new topic too
Advertisement