News:

Please note new Forum URL: forum.designcad.com

Main Menu

Scale By target distance Macro

Started by impulse, January 12, 2007, 09:29:06 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

impulse

In response to CrkrJacks Selection "UNITs" request.....
I suppose I could add a feature where you could enter 4 points and the selection would scale by their relative difference....maybe later
-impulse

' ---------------------snip here to end 8<-----------------------------------------
'scalebydist.d3m
'scales selected objects based on points set and distance

'first the error trapping
if sys(34) = 0 then
    ETxt$ = "No entity selected"
    goto Etrap
end if
If Sys(344) = 0 then
     ETxt$ = "Not really designed for Three-D Mode"
    goto Etrap
end if

sys(132) = 0 'xposition
sys(133) = -40 'yposition
window 2,35
locate 1,1
print "CJk's scale by Distance Macro"
print "Set points far the reference distance"

setpoint "Set points far the reference distance" 2
if sys(1) < 2 then end
pointval x1,y1,z1,1
pointval x2,y2,z2,2

Sys(36) = 1 
>AngleDistance
{
<PointXYZ [x1, y1, z1]
<PointXYZ [x2, y2, z2]
}
Sys(36) = 0  ' Disable the silent mode
XYDist  = Sys(650)

If xyDist = 0 then
     ETxt$ = "Scaling by zero is Dumb"
    goto Etrap
end if

sys(36) = 0
xydist$ = xydist
inptlne$ =  "Enter the target value for the distance  between these points " +  "[" + xydist$ + "]"

Input [inptlne$], targdist

scle = targdist/xydist

>SelectScale
{
<Scale [scle,scle,scle]
}
end

Etrap:
window 1,35
locate 1,1
print ETxt$
anykey
end