Move groups with different measures?
-
Seems indeed that some corrections were necessary
This time works like a charm! Excellent! TIG + Thomthom! Bravo!
I will see all that more in detail for learn this little cryptic language !
Very funny plug!
For the next Pilou's foolish...
...I need to know the "centroïd" (xyz) of a "bounding box's group"
Here of course without different measure, just for little test! (click image)
-
@unknownuser said:
...I need to know the "centroïd" (xyz) of a "bounding box's group"
centre_point=group.bounds.center
See http://code.google.com/apis/sketchup/docs/ for all these details
-
Thx I had missed this one
-
It'd help if you posted the error messages.
However, I can still see the problem here.
Sketchup::Component
isn't an SU object. Check the manual, you haveSketchup::ComponentDefinition
andSketchup::ComponentInstance
. In your case you're looking for aSketchup::ComponentInstance
. -
I have replaced "Group" by "Component" but seems that is not so simple
groups=[];selection.each{|entity|groups.push(entity) if entity.kind_of?(Sketchup;;Component)} groups.each{|component|zeds.push([component.bounds.min.z, index])
Else I can yet nest a component inside a group color transparent
That works fine (just disable Edges visible) but I suppose there is another thing
-
@ Tig Some cryptic but I will see that
Joint an image for no ambiguities
So here the increment is 300 cm
Edit sorry I have not seen all these speedy results!@Thomthom! Yes that is that ! e.transform!(t)
-
Come back in these very dangerous territories
As I understand that retrieve the center XYZ of the bounding box group by
center = boundbox.center
but how give these 3 values(?) to these 3 variables ?
xc= ?
yc= ?
zc= ?
must be trivial but yet some foggy for me
PS I read the API from the end to the start, and inverse but this stay mysterious found anything except that -
boundbox.center
returns an object of typePoint3d
. You can check what an object is by checking the.class
value of an object. That gives you an indication to where to look.xc= boundbox.center.x yc= boundbox.center.y zc= boundbox.center.z
-
Many thx!
It's always the more easy ans usefull who is not written as example -
??? = error : in ‘initialize’: undefined local variable or method ‘boundbox’
model = Sketchup.active_model entities = model.entities selection = model.selection #groups = [] xp=100 # Pivot Point yp=100 zp=100 xc=0 #Center Point of the grouped object yc=0 zc=0 xe=0 #End Point of the grouped object ye=0 ye=0 selection.each do |e| # update! # Skip all entities that aren't groups next unless e.is_a? Sketchup;;Group # Now we process the groups center = boundbox.center xc= boundbox.center.x # ??? error yc= boundbox.center.y zc= boundbox.center.z xe=xc ye=yc ze=zc if xc<xp xe =xc - 100 end if xc>xp xe =xc +100 end if yc<yp ye =yc - 100 end if yc>yp ye =yc +100 end if zc<zp ze =zc - 100 end if zc>zp ze =zc +100 end point = Geom;;Point3d.new xe,ye,ze t = Geom;;Transformation.new point # Apply the transformation e.transform!(t) end
-
That's because of
center = boundbox.center
<- you haven't referencedboundbox
yet.center = boundbox.center xc= boundbox.center.x # ??? error yc= boundbox.center.y zc= boundbox.center.z
change to
center = e.bounds.center xc= center.x yc= center.y zc= center.z
-
Thx!
More easy with that Works like a charm
I can now test some natures of explodes
-
Funny thing
-
Looking good Pilou!
Instant assembly drawings! This should come in handy. -
@unknownuser said:
Instant assembly
Alas for the inverse, that must be more tricky!
Better is use the Undo -
hm... You could store the relative position you move the entities by in and attribute dictionary. Then perform the opposite when you want to reassemble.
though, that will fail if the user moves anything...
Maybe, you could store the original absolute position before you move stuff. Then you can reassemble back to that original position. That would allow the user to move things around as they please. -
Store the original transformation in a dictionary attached to the group/component. Then to unexplode, just re-apply that transformation onto the group. It will go right back where it belongs.
I wrote that crazy scrambler script a while ago that does this and it worked very well.
Chris
-
In theory that must be more easy
Just select that you want and apply a "negative" translation : a deflation
Maybe my next
And the above is not yet perfect! The Pivot Point seems not have the wished result wanted
be continued...Ps When Groups or Components are nested how to process automatically?
A plug for make each components individual is maybe existing?
Edit
one exist for group by TIG Explode2groupsmiss now somethings transform Transform2goups or Explode2Components
-
@Chris Any chance to see it somewhere?
PS
A plug for make each components individual is maybe existing?
Edit
one exist for group by TIG Explode2groupsmiss now somethings for components Transform2goups or Explode2Components
-
take the componentInstance, add it to a group, then explode the component instance.
And I posted my scrambler script here. I'll see if I can find the thread.
Chris
Advertisement