DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

Multiple replace

Started by pnb, January 07, 2016, 11:29:09 AM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

pnb

I have decided that I need to change the diameter of a number of drawn holes (about 30) in my drawing.
Is there a way to do this with minimum of clicks / actions.

Thanks
Peter
DesignCad 3D Max 2021, 64bit

Bob P

I would figure out the ratio of the new diameter to the old, then use this macro.  If you enter the zoom factor in the original command line, all you have to do is snap to the center of each circle in turn and hit F3 to repeat the command.

'SelectZoom

'Save as sz.d3m
'Command line: sz <zoom factor>

precision 15
if sys(34)=0 then goto noselect

zoomx$=sys$(0)
'zoomx=val(zoomx$)

if (zoomx$)="" then
input "Enter zoom factor: ", zoomx
else
zoomx = val(zoomx$)
end if

sys(36)=1

>SelectScale
{
<Scale [zoomx, zoomx, zoomx]
}

sys(80)=0
goto end

noselect:
window 6,36
locate 2,12
Print "Nothing selected!"
locate 4, 4
print "Try again after selecting something"
anykey

End:

DrollTroll

Rather than use SelectScale, I'd recommend SelectScaleOrtho -- that way the circles remain circles, instead of becoming (circular) ellipses.

Or select them all, open the Info Box, go to the Detail view, and for each circle enter the new radius.

A faster macro would let him select them all, then use Query and Change on each selected circle to update the radius. If I get time I'll knock one out today.
25 years with DesignCAD

pnb

Thanks. Never used a macro with DC, could be interesting!
One thing I noticed when I investigated doing it individually that the dimensions of the hole was not as sized when I drew it but enlarged by the line thickness, which has been changed since drawn. Makes the zoom factor caculation a little harder!
Peter
DesignCad 3D Max 2021, 64bit

Bob P

According to the Info Box, the resulting resized circle is still a circular arc, and snapping to it only goes to the original center or edge points.

DrollTroll

#5
OK, Bob, maybe the macro version of SelectScale is smarter than the manual version; I just know if one isn't careful, it (the Scale command) can sometimes result in Ellipses instead of Circles.

Anyway, here's my alternate version of the macro (attached). I'll also put this in DrollTroll's Toolbox.

pnb, download this macro to your default DesignCAD macros folder (this'll be listed in the Options panel labeled "File Locations").
Then select the circles (and/or arcs) that you want to change, run this macro using Tools/Macro Execute, enter the new radius when prompted, and sit back and be amazed.

Also, if it's truly a circle, the Radius shown in the Info Box will be correct, regardless of the line width. My macro's easier than calculating the desired factor (IMHO) :D

DT
25 years with DesignCAD

pnb

Thanks both, to be amazed seems a good objective!
I was confusing the bounding box dimensions with circle radius, the detail view made that obvious, doh!

Thanks again.

pnb
Peter
DesignCad 3D Max 2021, 64bit

DrollTroll

BasicCAD is the ideal medium for many of these little 'one-off' objectives, that sometimes aren't needed often enough to warrant a built-in command, but can be too tedious to do 'by hand'.
25 years with DesignCAD

samdavo

#8
Thanks gents. 
Incidentally, thinking laterally, there must be a stack of "multiple edit" applications that are similar to this. 

And equally, just for discussion (you'll all be aware of this I am sure), if you choose a stack of entities including say lines, and then go to "lines" in Infobox, you can edit them all wrt width etc.

Finally, if you are in 3D, and want to change the diameter of a hole drilled through a solid, you can do that too
eg
reply #3 here   http://forum.designcad.com/index.php?topic=6117.0
better still reply #1 here   http://forum.designcad.com/index.php?topic=6153.0  = macro rapps.d3m

pnb

For the record I had tried selecting multiple circles (click, hold shift, and then click more) and altering the radius in Info but it consistantly only changed the first selected circle!? Selecting also became tricky as the bounding box started to obscure circles that still had to be selected.
I thought there might be a Group action that might do it and I was just unaware of it. However a macro is a good solution and has worked for me.

Thanks for everyones input.
pnb
Peter
DesignCad 3D Max 2021, 64bit

minstrel

Quote from: pnb on January 07, 2016, 11:29:09 AM
I have decided that I need to change the diameter of a number of drawn holes (about 30) in my drawing.
Is there a way to do this with minimum of clicks / actions.

Another approach - Tools/Block Define.

Adding 'Blocks' to your workflow, especially to those components you anticipate may/will need changes, would make such adjustments a cinch!

Search 'blocks' on the forum for tons of info...

DrollTroll

pnb -- when you have multiple items selected, the Detail view in the Info Box lets you look at the details of individual items. Pick the item you want from the drop-list to see its details.
25 years with DesignCAD

pnb

Never knew that! It must have just used the item at the top of the list.

Thanks that's a good tip.
Peter
DesignCad 3D Max 2021, 64bit

Lar

Quote from: Bob P on January 07, 2016, 11:51:56 AM
I would figure out the ratio of the new diameter to the old,
Rather than figuring out ratios just use this formula:

   what you want it to be / what it is

Eg, if something is 1.00035 and you want to scale it up to 5 just enter 5/1.00035 and the result would be 5.

You can also use this formula in macros...

'entity must be selected...

'macro determines sizes of selected entity's bounding box...
boxX=sys(198)-sys(196)  'maxX-minX..
boxY=sys(199)-sys(197)  'maxY-minY..
boxZ=sys(201)-sys(200)  'maxZ-minZ..

'user enters the new sizes...
input "Enter the 3 new sizes for X, Y and Z each (separate each size by a space or comma)..." iX, iY, iZ

>SelectScale
{
<Scale [iX/boxX, iY/boxY, iZ/boxZ]
}


Note that if you want change the radius of a circle don't use this formula in the info box, just enter the new radius.

Lar