Joint locations-export/save
-
is there a way... to move a joint, and export the position? how about several? dozens? seems something that would be useful... it'd be useful to me... it'd be good to export as either angle, or coordinates of the joints. i have something i work on that uses coordinates, instead of angle, and the hand editing of the file is not easy.
-
Well give us a format example, getting positions and joint data is dead simple you only need to say how you want it presented, then I can make you a rough example.
-
Mr. K...I could muster some of what was requested but this generated more questions than answers. Could you also add in some insight on how the definitions of what is attached to what are stored in the data structures(connects to ???). I am trying to learn Ruby both as it works in sketchup but also more powerfully in how it works in Sketchy Physics. Thanks heaps.
-
Well I wrote a bit more on this here: http://sketchyphysicscommunity.webs.com/apps/forums/topics/show/1568658-su-advanced-scripting
And the SU API is a great resource of extras:http://code.google.com/intl/sl/apis/sketchup/docs/classes.htmlSo to this particular problem:
-
first you need a list of all objects in the model
entities = Sketchup.active_model.entities -
then you check if the object is a group/component(the only ones important in SP)
ent1 = entities[0]
if ent1.class==Sketchup::Group or ent1.class==Sketchup::ComponentInstance -
and then you read the attributes SP uses to store joint data and connections
joint_name = ent1.get_attribute("SPJOINT","name")
If it isn't a joint this will just return nil, and if it is you can read anything you want.
ent1.get_attribute("SPJOINT","type")
ent1.get_attribute("SPJOINT","min")
ent1.get_attribute("SPJOINT","max")
ent1.get_attribute("SPJOINT","damp")
...
Best way to actually view all these is with the attribute manager plugin:
http://code.google.com/p/sketchupattributemanager/downloads/list
-
-
i just wanted to bang out some kind of list i could use to turn into an imvu pose. there's already an imvu exporter, perhaps pausing and exporting current position would do it...
[ed] yaknow... if it worked, and the positions could be played back, it'd give sketchup a fully functioning keyframe animation system. i can't remember if it's been done yet, or i wouldn't mention it.
Advertisement