(I think that was the thread I was thinking of...)
It doesn't qualify as a Ruby script because it depends on two pre-made components - one for horizontal dimensioning and one for vertical (you could rotate for the vertical, but I chose to place the vertical dimensioning outside the lines.)
Also, the .rb files assume another routine to locate components. ($component_folder)
But I will share the code if any other ruby developers want to use it.
def hdim(ploc, len)
model = Sketchup.active_model
entities = model.active_entities
sname = "CS_hdim-240"
clen = 240 # size of component in inches
# see if we have already loaded the component
definition = model.definitions[sname]
if (definition == nil)
skp_name = sprintf("%s\\%s.skp",$component_folder,sname)
definition = model.definitions.load(skp_name)
end#def
instance = entities.add_instance(definition, ploc)
transformation = Geom;;Transformation.scaling(ploc, len/clen, 1, 1)
instance.transform!(transformation)
end#def
def vdim(ploc, len)
model = Sketchup.active_model
entities = model.active_entities
sname = "CS_vdim-240"
clen = 240 # size of component in inches
# see if we have already loaded the component
definition = model.definitions[sname]
if (definition == nil)
skp_name = sprintf("%s\\%s.skp",$component_folder,sname)
definition = model.definitions.load(skp_name)
end#def
instance = entities.add_instance(definition, ploc)
transformation = Geom;;Transformation.scaling(ploc, 1, len/clen, 1)
instance.transform!(transformation)
end#def
Let me know if you want to components as well. They both have the dimension lines pointing to 0,0.