Component Axis place at specific Height

I would like to reset a bulk of components Z axis to be a specific height from the origin.

Is there a fast way to do this?

If you want all of them at the same height, select them all, start to move them then type [,n] and hit enter, where n is the height above 0 and there are two commas, the forum edits out one.

No i’m looking to change the axis Z location of the components, not their actual location in the model

To make sure we understand: you want to move the origin of each component’s axes up in the z direction by a given amount without the component instances themselves moving in the model?

Exactly (though i would like to move the axis in Z down not up) specifically to the height of the model origin

I believe it would require making each instance unique since the axis origin is part of the definition.

ent = mod.entities
sel = mod.selection
SKETCHUP_CONSOLE.clear
sel.grep(Sketchup::ComponentInstance).each{|comp|
  comp.make_unique
  tran=comp.transformation
  cde=comp.definition.entities
  t=tran.to_a
  old = comp.transformation.origin
  new = old.offset(Z_AXIS,-old.z)
  t[12]=new.x;t[13]=new.y;t[14]=new.z
  comp.transformation=tran.set!(t)
  tr=Geom::Transformation.new(old-new)
  cde.transform_entities(tr,cde.to_a)
}
1 Like

I tried out a similar idea and ran into issues if a component instance has been scaled.

Yes I see what you mean but apparently only if scaled in Z

Does this extension do the tric?
https://extensions.sketchup.com/nl/content/eneroth-line-axes

Yeah, that’s because the origin is being shifted in z. I think the answer is that the change in the instance’s z has to be scaled the same relative to the amount the definition’s z was moved.

Maybe Curic Axis? https://www.youtube.com/watch?v=j3NT9i10As4&list=PLpAF98qEu2vCAuxkBhUkvi-fPFG7Mv27p&index=4

Thank you all for the great suggestions

And especially @sdmitch for the code!

Will try them all :grin:

Thank you for the code as it was the best option :grin:

Just a question, is there a way to change the axis without making them unique? As I would like the axis to change for all the components instance.

What about creating a group above each component instance and assigning them the desired axis positions?

I’m looking for a less manual way of doing this

I think we may be working at cross-purposes.
You can readily move component-instances just vertically in the Z-axis so that their insertion-points are reset to a specific Z value relative to the model’s origin.
This does not require making anything unique.

There are already several [old] scripts to do this ‘drop’…

Here’s an old one: https://sketchucation.com/pluginstore?pln=smartdrop
or: https://sketchucation.com/forums/viewtopic.php?p=287719#p287719
or: http://www.smustard.com/script/Drop

There may be some in the EWH… but I think they might be duplicates… e.g.
https://extensions.sketchup.com/en/content/dropgc

I do not want to move the actual components just their axis. Specifically moving the axis to a height level specific to the origin axis

I’m curious about what you will do with this. How will you use this once you’ve got it? Looks like there have been several options presented that would do what you ask.

You cannot move the axes [insertion-points] of several instances of the same component to a fixed z-value without either moving some of them or using make_unique to affect each in turn…

I’m using this to better certain workflows. An example would be window schedules.

As i would need the floor level height showing for the windows, having the axis adjust to the floor level would reduce the errors and time it takes to currently create them