Thanks TIG!
I just found an easiest way on the forum.
...
pages.selected_page = pages["Scene 2"]
It was on an older post answered by Jim.
http://www.sketchucation.com/forums/scf/viewtopic.php?f=180&t=8704&p=52285
Thanks TIG!
I just found an easiest way on the forum.
...
pages.selected_page = pages["Scene 2"]
It was on an older post answered by Jim.
http://www.sketchucation.com/forums/scf/viewtopic.php?f=180&t=8704&p=52285
Hello,
I'm trying to go and view to a defined scene with a script.
model = Sketchup.active_model
pages = model.pages
and then
pages.select, .view, .show... show_page, .activate, ...
But did'nt succeed.
What would be the solution? Jim?
Hi John,
@unknownuser said:
Is the script intended to work or is it supposed to select all family instances at once?
it has been fixed (DL on the first post)
Hi John,
I don't understand what's wrong with the list. Do you mean in your plugins folder? You should erase the former version, the one without the "v2", from this folder.
I tried again and again and everything is ok on my side. What are the name of your components ?
Hello,
I'm trying to find a clue in order to allow to undo multiple actions that occure from a ruby script, during the execution of this script.
I don't know if it's clear enough? Imaginea user starts a script that insert component one by one, with coordinates inserted by the user (obviously, the user is just me...), but I realise I was wrong two steps ago... so I want to go back and restart, even get my variables back as it was before.
Who can help?
@sepo said:
I have installed the version 2 from the top of this tread.
Thanks
Hi sepo, What are the name of your instances? select instances only works when components are selected, no groups allowed in the selection set.
Are you sure you've deleted the first version of the plugin?
@jorgensen said:
Would it be possible to change the script so that it don't select instances that are hidden, or instances that are on a hidden layer ?
Yes it is. It's even far better. The link on the first post has been refreshed
@rickw said:
Wow, I need to do more marketing! Instances has been available at Smustard for a couple of years, now.
You've added some nice additional functionality.
Oops, I wish I could know this a couple of years ago
Thanks Rick!
The new version (v2) has been posted!
See above.
Great Macs!
I'll test it as soon I'll go back to my codes.
Thanks A lot.
Hello,
Anyone knows how to retrieve a value from the status bar, on the bottom right, to a ruby script?
Thanks!
Hi there,
You'll find a short .rb files that select component instances on the fly.
You just have to select one or more different components one your model, right click and choose "Select Instances" on the drop down menu.
I tought it would be faster to attach this plugin on this drop down menu.
Rather than to go on your "Component window" with this bunch of compo, and hunt for the one you need to select in the entire model, this plugin should simplify.
NEW Version 2:
This new version includes a new function that is "Select Families" on right click.
A family would be a bunch of components that were created by making a parent compo unique.
Every component name that begins with the same name before the '#' will be considered as part of the family. Capisci?
So just create a component, copy it a couple of time, make one of the instance unique, select any of the created component and right click "Select families".
Enjoy!
Not realy clear for me yet.
If I understand well, that means "transformation" is usefull for add_instance (f.e.) A kind of insert definition
transform1 = Geom;;Transformation.new inspoint
instance = entities.add_instance componentdefinition, transform1
and "transform!" to modify this instance.
instance.transform!(transform2)
But I'll get use to it.
Thanks both of you for your help.
I found it but do not really understand the reason why I must use .transform! instead of .transformation= ... (Todd?)
So to rotate around the perfect insertion point of the component, type:
UI.messagebox "Applying a new Transformation (in this case, a rotation)"
instance.transform!(transform2)
instead of:
UI.messagebox "Applying a new Transformation (in this case, a rotation)"
status = instance.transformation=transform2
Hope this will help others.
Thanks Todd,
Glad I found the Geom::Transformation.rotate's key master.
It seems there's no other... I'll wait for your help
To all others:
if I don't get an answer on december 24th, feel free to help me, I'm sure King Todd will not be upset.
Hello again,
I'm trying to explore how to insert and rotate an external component. But I can't figure out how geom::Transformation.rotate works...
I can't manage the rotation point... If I set inspoint at 0,0,0 and destpoint at 0,0,0 it works fine.
but if I change inspoint and destpoint it doesn't rotate the component around it.
So I tought I could do it in 3 steps.
def insertrotate
zaxis = Geom;;Vector3d.new(0,0,1)
inspoint = Geom;;Point3d.new 0.cm,0.cm,0.cm
destpoint = Geom;;Point3d.new 100.cm,100.cm,0.cm
transform = Geom;;Transformation.new inspoint
model = Sketchup.active_model
entities = model.active_entities
path = Sketchup.find_support_file "a_file.skp" ,"a_directory_under_sketchup_dir"
definitions = model.definitions
componentdefinition = definitions.load path
instance = entities.add_instance componentdefinition, transform
transform2 = Geom;;Transformation.rotation(inspoint,zaxis,90.degrees)
transform3 = Geom;;Transformation.new destpoint
UI.messagebox "Applying a new Transformation (in this case, a rotation)"
status = instance.transformation=transform2
UI.messagebox "Applying a new Transformation (in this case, a move)"
status = instance.transformation=transform3
end
Thanks Jim!
Once again, you hit the mark.
First, I missed the ".collect" and get a bug on sketchup.
Have you got any idea what scan order is prefered in the 'do' loop?
Any way to sort the collection?
Hello!
I'm building a selection set and would like to view every component instance, one by one, in the selection.
ss = Sketchup.active_model.selection
ss.each do |e|
if( e.kind_of? Sketchup;;ComponentInstance )
...
What can I insert in the "do" loop operation in order to visualy highlight every instance?
Thanks for your help!
first I define a variable, that define a Z ccordinate (in cm because my drawing units are so)
$startcoord = 100
Then I put a component in memory to get its boundaries
component_path = Sketchup.find_support_file filename , dirname
$instance = definitions.load component_path
bounds = $instance.bounds
bmax = bounds.max
bmaxx = bmax.x
bmaxy = bmax.y
bmaxz = bmax.z #in this case 20,0cm f.e.
The problem is that when I ask to return the bmaxz value, I get it in cm because the component itself file is drawn in cm. if I make an addition of addition = bmaxz+$startcoord (20,0cm + 100) It's transformed into inches (I presume) and addition.to_cm returns an "unrounded" value 120,00000000002.
I tried do define $startcoord as 100.0.cm but it doesn't change it.
please help