Drawing construction points and lines have an unexpected orgin

That was it, thank you so so so much!

I found this article that seems to also show how to do the scaling with ruby as well, so I’ll give that a try: "Scale Definition" via Ruby - #4 by ene_su

edit: for anyone who might see this thread later, this totally works as you would expect, doing the linked transformation corrects the drawing exactly as you would expect.

def descale_object(instance)
  old_transformation = instance.transformation
  new_transformation = Geom::Transformation.axes(
  old_transformation.origin,
    old_transformation.xaxis.normalize,
    old_transformation.yaxis.normalize,
    old_transformation.zaxis.normalize
  )
  
  transformation = new_transformation.inverse * old_transformation
  instance.definition.instances.each do |i|
    i.transformation *= transformation.inverse
  end
  
  entities = instance.definition.entities
  entities.transform_entities(transformation, entities.to_a)
end

# cutting out some code, thats in the original ruby file
   shelf = children[0] # this seems to be selecting the component, so copies get made
   puts shelf.definition.name # just a quick check
   
   descale_object(shelf)


   # do I create a new little triangle and just subtract?
   # x,y,z
   entities = shelf.definition.entities


   entities.add_cline([chamfer,0,0], [0,chamfer, 0])
   entities.add_cline([chamfer, depth, 0], [0, depth-chamfer, 0])
   entities.add_cline([width, depth-chamfer, 0], [width-chamfer, depth, 0] )
   entities.add_cline([width, chamfer, 0], [width-chamfer, 0, 0] )


1 Like