Created geometry on auto-move mode
-
wow that was a fast reply, thanks jim!
Now i'll just have to dig out how the ComponentDefinition class works, as my geometry is at the moment only a group.
[lekonna]
-
@lekonna said:
wow that was a fast reply, thanks jim!
Now i'll just have to dig out how the ComponentDefinition class works, as my geometry is at the moment only a group.
Nah, just try it with the Group, it might work. But if not, you just create a new ComponentDefinition instead of a new Group and use the Defs entities. You shouldn't need to change but one line of code (maybe.)
-
Error; #<TypeError; wrong argument type (expected Sketchup;;ComponentDefinition)>
dang model.definitions seems to retrieve the list of component definitions in the model, but how do i go about creating one and assigning this group to it?
[lekonna]
-
cdef = Sketchup.active_model.definitions.add("Component Def Name")
Oh, you already have a Group. I forgot about Group.to_component !
-
alright. the documentation seems to be bit incomplete on that method.
what i tried was:
component = group.to_component status = model.place_component component
and what i got was
Error; #<TypeError; wrong argument type (expected Sketchup;;ComponentDefinition)>
so it would seem that it doesn't return a componentdefinition
[lekonna]
-
haa gotit!
the to_component returns a componentInstance which has the
definition method returing just what i needed.Thanks a ton Jim!
[lekonna]
-
hmm it seems that now i get double geometry, the one i place with the place_component and one created at 0,0,0 duh.
[lekonna]
-
Geez it seems i'm lost with this coding business, well it's been like 5 years, thats what managering stuff does to you i suppose.
Can you guys point a good way to get rid of the double geometry for me? If i just go ahead and upload the script here. Though i have to appologize for the code since the variables and texts are in finnish. Was bit too sure i could pull one simple script off by myselfs
So the problem being on how to get rid of the double geometry thats not folling the place_component.
Thanks in advance, should be no-brainer for you guys.
-Janne
http://www.sketchucation.com/forums/scf/sas/Ruby/windower.rb
[lekonna]
-
You want to create a ComponentDefinition from the start. Try these changes:
33; definition = Sketchup.active_model.definitions.add("New Def") 34; entities = definition.entities ... 113; (removed) 115; (removed)
-
perfect, thanks Jim!
[lekonna]
Advertisement