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.

Proportional adjustment of all scale related settings

Started by Rob S, January 07, 2008, 10:23:03 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Rob S


How close is anyone to having a macro that would adjust all of my text size, dimension text, arrowhead size, gaps, overshoots, etc for all of the dimension types in one fell swoop by a factor that I would enter when the macro runs???

Idea being, if I'm drawing for printing at a scale of 1:100, and everything looks good and in proportion, then if I want to draw for 1:50, all I would have to do is run the macro, and enter 2 as my factor.

I spent some hours today trying to set up a workspace for metric and one for imperial drawings, but all of the numerous settings there are for each type of dimension, and the absence of the paste button makes this quite chore.
User since forever

herbertjackson

There is a problem with what you would like to do. I wish I could do it also. Most of my drawings are in 1/8

bdeck

Hi Rob,


In version 18 it is not possible to adjust gap and overshoot in a macro unless the macro calls an external executable or redraws the entire dimension from scratch.

Maybe some new alias parameters will make that possible in the future.

In versions 14-17.2 it is possible to adjust gap and overshoot in a macro. But those earlier versions also require adjustment to dimension line ends when text size is changed. And changes to D_arrowsize differ between v18 and prior versions.


The macro below will change all text and arrow sizes in a single operation. It works only in versions 18 and later.

It uses a preset constant "aptf", rather than an input statement, to determine arrowhead size factor.

Also it does not adjust balloon size.

Hope this helps.

BD




'sizer.d3m     B. Deck   1/08

'Resize text and arrows for all entities or for all selected entities.
'Works in DC version 18 and later.

'If any entities are preselected, this macro will change the text and arrow size only on selected entities.
'Otherwise, it will change text and arrow size of all entities.

'Set arrow size factor as a constant aptf in the macro.

'Input 0 at text size prompt to cancel macro.


'*********  set constants  ********************'

aptf=1      'arrow per text factor, sets arrow size as fraction of text size.
            ' default = 0, defaults to Dcad default arrow sizing.
           
'***********************************************************'

Alias D_ARROWSCALE            &H0A02  'R/W - f
Alias D_ARROWSIZE             &H0A03  'R/W - f
Alias D_TEXTSIZE              &H0A04  'R/W - f
Alias T_SIZE                  &H0502  'R/W - f
Alias AW_SIZE            &H0903
Alias AW_SCALE                &H0902

sys(470)=1  ' stop other commands

ne=sys(80)                          ' look for selected entities

doall = 0
if ne <1 then
   ne=sys(9)
   doall = 1
endif

if doall = 1 then
   INPUT "Input text size for ALL entities, 0 to exit.  ", dts
else
   INPUT "Input text size for selected entities ONLY, 0 to exit.  ", dts
endif

' INPUT "Input ratio of arrow size to text size or zero. ", aptf      ' Optional input statement for arrow scale factor

if dts >0 then
   for i=1 to ne

      if doall>0 then
         entno =i
      else
         Getselect i, entno
      endif

       gosub fix
   next
   

      regen
endif

end


fix:
   entity entno       

   change D_TEXTSIZE, dts
   change T_SIZE, dts

   if aptf>0 then
             change D_ARROWSIZE, aptf*dts
      change AW_SIZE, aptf*dts
        endif
        update
return

bdeck

Rob,

Here's the same macro using a scale factor instead of a fixed size.

BD


'scaler.d3m     B. Deck   1/08

'Rescale text and arrows for all entities or for all selected entities.
'Works in DC version 18 and later.

'If any entities are preselected, this macro will change the text and arrow size only on selected entities.
'Otherwise, it will change text and arrow size of all entities.
'Input 0 at scale factor prompt to cancel macro.

'************************************************

Alias D_ARROWSCALE            &H0A02  'R/W - f
Alias D_ARROWSIZE             &H0A03  'R/W - f
Alias D_TEXTSIZE              &H0A04  'R/W - f
Alias T_SIZE                  &H0502  'R/W - f
Alias AW_SIZE            &H0903
Alias AW_SCALE                &H0902

sys(470)=1  ' stop other commands

ne=sys(80)                          ' look for selected entities

doall = 0
if ne <1 then
   ne=sys(9)
   doall = 1
endif

if doall = 1 then
   INPUT "Input scale factor for ALL text and arrow entities, 0 to exit.  ", scfactor
else
   INPUT "Input scale factor for selected text and arrow entities ONLY, 0 to exit.  ", scfactor
endif

if scfactor >0 then
   for i=1 to ne

      if doall>0 then
         entno =i
      else
         Getselect i, entno
      endif
       gosub fix
   next
regen
endif


end

fix:       

   entity entno       

            query D_TEXTSIZE, dts
   change D_TEXTSIZE, dts * scfactor

            query T_SIZE, ts
   change T_SIZE, ts * scfactor
   
   query D_ARROWSIZE, das
          change D_ARROWSIZE, das * scfactor

   query AW_SIZE, aws
   change AW_SIZE, aws * scfactor
       
        update
return



Lar

bdeck, in both macros you have this line:

sys36=0

located in the following section of macro 2, (and the equivalent location in macro 1):

if scfactor >0 then
   sys36=1
   for i=1 to ne

sys36 should be sys(36), unless you are using it as a variable, which doesn't seem to be the case.

Lar

bdeck

Lar,

Oops.

That's why one  I  should never edit code online.

Actually, sys(36) is not necessary in this macro. it is vestigial from a bigger program.

Regards,

BD

bdeck

Quote from: bdeck on January 13, 2008, 12:10:07 PM
In version 18 it is not possible to adjust gap and overshoot in a macro unless the macro calls an external executable or redraws the entire dimension from scratch.


Same is true for arrowhead position, which can be edited (albeit with some complexity) in previous versions, but not in 18+.

Also, it would be a nice touch if balloon size would adjust automatically when balloon text is resized.

Finally, the following macro, which might have been used to toggle arrow position prior to drawing dimensions, does not work correctly in version 18+.

BD

' isop.d3m      B. Deck   
' in-side-out-prior macro to toggle dimension arrow position prior to drawing dimension
'
sys(415)=1-sys(415)
end



Dr PR

A better solution would be for DesignCAD to allow us to select all dimensions of a particular type (linear, angle, radius, diameter, etc.) with the selection filter, then select the part (or all) of the drawing we want to change, and edit all user definable parameters from the Info box.
DesignCAD user since 1987

Rob S

Methinks I explained badly.  The above macro works very well for changing existing dimensions.

What I was looking for was a macro which would (probably in a blank drawing) change all of the settings in my options, relating to all text and dimension types.  (text size, offset, arrowhead size, gap, overshoot, etc, for each type)

To do this, one needs to know all of the sys(??) numbers involved, and multiply them all by the factor.

I've got my options set up so everything is in the right proportions, but if I want to draw for a different scale output, I need to reset about 50 or so settings by hand.
User since forever

bdeck

Hi Rob,

Design Cad is sort of a moving target when it comes to dimensions.

I'm on the road now, and dont have v18 on my laptop.

But heres a macro works well in version 14 and sort of in 17.2.

I've modified it to allow at least 5 different scaling and sizing modes.


BD


'tsize.d3m   01/08   BD 

'Macro to change text and dimension settings prior to drawing.

'******************* Set Parameters
scalemode = 2    'choose between 0) resizing, 1) scaling,  and 2) tweaking up or down by a fixed factor

tweakfactor= 2^.5  'This is the most useful scaling factor Ive found.

dptf= 1    ' preset dimension text/ text factor (if zero, existing dim txt will be rescaled, ignoring text size )
aptf= .8   ' preset arrow per text factor
bptf=  1  ' preset balloon radius per max text size factor

gptf= 1    ' preset constant extension line gap/ dim text size factor
xptf= .5   ' extension overshoot/ dim text size factor
ttpf= .5   ' Tolerance size/ dim text size   (over/under tolerances only)

'************* Constants
k_ret = 13
k_up = 38
k_dn = 40
k_lft = 39
k_rt = 37
k_esc =27

if dptf=0 then dptf=sys(438)/sys(12)     

print "Current Text Size = ", sys(12) , "       Dim Txt Sz = ",sys(438), "  Adust size w/cursor keys" 
if scalemode =0 then
     input "Input Text Size, 0 to cancel ", ts     
endif
if scalemode=1 then
     input "Input Text Scale Factor, 0 to cancel ", ts0       
     ts=ts0*sys(12)              
endif
if scalemode =2 then
     ts0=1
     do while k<> k_ret
      anykey k 
        if k=k_esc then end 
      if k=k_up then ts0=ts0*tweakfactor
      if k=k_rt then ts0=ts0*tweakfactor
      if k=k_dn then ts0=ts0/tweakfactor
      if k=k_lft then ts0=ts0/tweakfactor
      TempTs=ts0*sys(12)
      tempDts = TempTs *dptf
      print "Current Text Size = ", tempTs , "    Dim Txt Sz = ",tempDts _
                           , "  Adust size w/cursor keys,  Scale=  ",ts0       

      loop
      ts=ts0*sys(12)
           
endif


if ts = 0 then end
if ts < 0  then end

sys(12)=ts                        'Default text size
sys(438) = ts * dptf             ' Dimension text size 
 

'******************* Arrow size needs changing in v 17.2
ts1=ts

if sys$(105)< "17.0" then ts1=1       'Check version no
sys(462) = ts1 * aptf * dptf                    'Dimension arrowhead scale

'******************* parameters below are scaled from dimension text size in all versions through 17.2
'******************* No telling how they'll be changed in the future.
sys(43) = gptf        'Gap between dimension text and arrows
sys(442) = xptf      'Overshoot of Dimension extension lines
sys(441) = ttpf      'Dimension tolerace size
sys(446) =  bptf           'Balloon radius.

END

Rob S

#10
OK, I tried your first version, and it sort of works in V18. Definitely the right idea I was looking for.

The weird thing is, it changes the text size for ALL types of dimensions ie Linear, co-ordinate, extended, baseline, etc. 

This leads me to believe there is an overriding sys(xx) function for all text size.  How this relates to the ability to set individual preferences for this option for each type of dimension escapes me.

However, it affects the arrowhead size for ONLY linear dimensions and not the others.

It seems sort of hopeless until we get an update on what the different SYS(xx) functions mean in V18, as they relate to all of the new dimension types.

ps top the above - I gues the options dialog works the same way resetting one text size resets them all, but resetting one type of arrow size affects only that one dim type.

Weird...
User since forever

bdeck

Rob,

This was a clear case for brute force.

The macro below draws a prototype of each type of dimesion and text,  and presets the parameters as you choose.

Parameters for each type can be set separately, or they can all be the same.

Tolerances can be set separately for each type of dimension, if desired.



Note:

Half ass tested in version 17.2.

Running this macro erases any text in the text buffer, because the buffer is not available as a sys$() variable.

2d Text renders slightly differently from dimension text and pullout text.

bd





'dss.d3m   dimension super sizer  01/2008   bd       macro to preset dimension paramters


print "Current Text Size = ", sys(12)
input "enter desired text size",  ts       

if ts=<0 then end

aptf=.7 * ts  ' arrow size   ***** change this line if necessary for earlier versions
if sys$(105)<"17.0" then aptf=aptf/ts
gptf=1        ' gap factor   
xptf=.5        ' extension line overshoot factor   
Locn=0       ' Text location
Prcn=3       ' precision
at2=4        ' arrowhead type:   NOTE this is not the same as sys(104)
xdts=ts      ' extended text size
fmt=0        ' text format
a$=" "       ' current text is not accessible as sysvar, so it must be erased


pd$="2"      ' diam prefi'x
sd$="0"      ' diam suffix
pr$="1"      ' rad prefix   
sr$="0"      ' rad suffix

sys(36)=2

>DimExtend
{
<Arrowhead [at2]
<Arrowsize [aptf]
<Size [xdts]
<Gap [gptf]
<Overshoot [xptf]
<Format [fmt]
<Precision [Prcn]
<Location [Locn]
'<Tolerancetype 1
'<Tolerance 0.002
<Pointxyz 10, 15, 0
<Pointxyz 40, 10, 0
<Pointxyz 100, 10, 0
<Pointxyz 110, 20, 0
}

>DimProgress
{
<Arrowhead [at2]
<Arrowsize [aptf]
<Size [xdts]
<Gap [gptf]
<Overshoot [xptf]
<Format [fmt]
<Precision [Prcn]
<Location [Locn]
'<Tolerancetype 1
'<Tolerance 0.002
<Pointxyz 10, 10, 0
<Pointxyz 40, 15, 0
<Pointxyz 100, 10, 0
<Pointxyz 110, 20, 0
}
>DimBase
{
<Arrowhead [at2]
<Arrowsize [aptf]
<Size [xdts]
<Gap [gptf]
<Overshoot [xptf]
<Format [fmt]
<Precision [Prcn]
<Location [Locn]
'<Tolerancetype 1
'<Tolerance 0.002
<Pointxyz 10, 10, 0
<Pointxyz 40, 15, 0
<Pointxyz 100, 10, 0
<Pointxyz 110, 20, 0
}

>Pullout
{
<Orientation 2
<Arrowhead [at2]
<Arrowsize [aptf]
<Size [ts]
<Pointxyz 5, 0, 0
<Pointxyz 10, 0, 0
<Text [a$]
}

>Balloon
{
<Orientation 2
<Arrowhead [at2]
<Arrowsize [aptf]
<Size [ts]
<Pointxyz 5, 0, 0
<Pointxyz 10, 0, 0
<Text [a$]
}

>DimAngle
{
<Arrowhead [at2]
<Arrowsize [aptf]
<Size [ts]
<Pointxyz 5, 0, 0
<Pointxyz 10, 0, 0
<Pointxyz 10, 10, 0
<Pointxyz 10, 10, 0
}

>DimRadProgress
{
<Format [fmt]
<Precision [Prcn]
<Arrowhead [at2]
<Arrowsize [aptf]
<Size [ts]
<Pointxyz 10, 10, 0
<Pointxyz 20, 15, 0
<Pointxyz 35, 10, 0
<Pointxyz 50, 10, 0
<Pointxyz 50, 15, 0
}

>DimCoordinate
{
<Format [fmt]
<Precision [Prcn]
<Arrowhead [at2]
<Arrowsize [aptf]
<Size [ts]
<Pointxyz 0, 0, 0
<Pointxyz 10, 15, 0
<Pointxyz 11, 15, 0
}

>Arc4
{
<Pointxyz -10, 0, 0
<Pointxyz 0, 0, 0
<Radius 0 'turns off fixed-radius option
<Pointxyz -10,10, 0
}

>DimArc
{
<Format [fmt]
<Precision [Prcn]
<Arrowhead [at2]
<Arrowsize [aptf]
<Size [ts]
<Pointxyz 0, 0, 0
<Pointxyz 10, 0, 0
}

>DimDiameter
{
<Type 0
<Format [fmt]
<Precision [Prcn]
<Axis 2
<Arrowhead [at2]
<Arrowsize [aptf]
<Prefix [pd$]
<Suffix [sd$]
<Size [ts]
<Pointxyz 0, 0, 0
<Pointxyz 10, 0, 0
}

>DimRadius
{
<Format [fmt]
<Precision [Prcn]
<Axis 2
<Arrowhead [at2]
<Arrowsize [aptf]
<Prefix [pr$]
<Suffix [sr$]
<Size [ts]
<Pointxyz 0, 0, 0
<Pointxyz 10, 0, 0
}

>line
{
<Pointxyz 0, 0, 0
<Pointxyz 10, 10, 0
}

>DimChamfer
{
<Format [fmt]
<Precision [Prcn]
<Axis 0
<Arrowhead [at2]
<Arrowsize [aptf]
<Size [ts]
<Pointxyz 0, 0, 0
<Pointxyz 10, 0, 0
}

>Dimension
{
<Arrowhead [at2]
<Arrowsize [aptf]
<Size [ts]
<Gap [gptf]
<Overshoot [xptf]
<Format [fmt]
<Precision [Prcn]
<Location [Locn]
'<Axis 0
'<Tolerancetype 1
'<Tolerance 0.002
<Pointxyz 10, 10, 0
<Pointxyz 40, 10, 0
}

>Text
{
<Size [ts]
<Text [a$]
<Pointxyz 10, 10, 0
<Pointxyz 40, 10, 0
}

for x=1 to 26
>Eraselast
{
}
next x

sys(36)=0
regen
end

Rob S

User since forever

Rob S


This works great!!! 

Odd though - after I run it, it takes a few clicks and esc keystrokes before I can set points again.

See below, version modified a bit for V18, which requires the addition of text offset which sets the space between the text and the dim line.

I also added some parameters to get my extended dim text over the second extension line.

For some reason, I can't get this to stick for baseline dimensions.

Format is currently set for imperial

I think it would be nice to add a user variable for the text format.


'sts.d3m    01/2008  bd       macro to preset dimension paramters

print "Current Text Size = ", sys(12)
input "enter desired text size",  ts       


aptf=.8 * ts  ' arrow size    ' *************   change this line if necessary
gptf=.3 * ts  ' gap factor
xptf=.5 * ts  ' overshoot factor
optf=.25 * ts' text offset
bptf=1.5*ts  ' offset for baseline
Locn=0       ' Text location
Prcn=3       ' precision
at2=4        ' arrowhead type:   NOTE this is not the same as sys(104)
xdts=ts      ' extended text size
fmt=3        ' text format
a$=" "       ' current text is not accessible as sysvar, so it must be erased


sys(36)=2   ' silent mode

>DimExtend
{
<Arrowhead [at2]
<Arrowsize [aptf]
<Size [xdts]
<offset [optf]
<Gap [gptf]
<Overshoot [xptf]
<Format [fmt]
<Precision [Prcn]
<Location [Locn]


'<Tolerancetype 1
'<Tolerance 0.002
<Pointxyz 10, 10, 0
<Pointxyz 40, 10, 0
<Pointxyz 100, 10, 0
<Pointxyz 100, 100, 0
}

>DimProgress
{

<Arrowhead 7
<Arrowhead2 [at2]
<EnableSecondArrow 1
<DimHorizontalTextPos 5
<DimVerticalTextPos 2

<Arrowsize [aptf]
<Size [xdts]
<offset [optf]
<Gap [gptf]
<Overshoot [xptf]
<Format [fmt]
<Precision [Prcn]
<Location [Locn]
'<Tolerancetype 1
'<Tolerance 0.002
<Pointxyz 10, 10, 0
<Pointxyz 40, 10, 0
<Pointxyz 100, 10, 0
<Pointxyz 100, 100, 0
}

>DimBase
{

<Arrowsize [aptf]

<Arrowhead 7
<Arrowhead2 [at2]
<EnableSecondArrow 1
<DimHorizontalTextPos 5
<DimVerticalTextPos 2
<dimoffset [bptf]

<Size [xdts]
<offset [optf]
<Gap [gptf]
<Overshoot [xptf]
<Format [fmt]
<Precision [Prcn]
<Location [Locn]
'<Tolerancetype 1
'<Tolerance 0.002
<Pointxyz 10, 10, 0
<Pointxyz 40, 10, 0
<Pointxyz 100, 10, 0
<Pointxyz 100, 100, 0
}


>Pullout
{
<Orientation 2
<Arrowhead [at2]
<Arrowsize [aptf]
<Size [ts]
<offset [optf]
<Pointxyz 5, 0, 0
<Pointxyz 10, 0, 0
<Text [a$]
}
>Eraselast
{
}

>Balloon
{
<Orientation 2
<Arrowhead [at2]
<Arrowsize [aptf]
<Size [ts]
<offset [optf]
<Pointxyz 5, 0, 0
<Pointxyz 10, 0, 0
<Text [a$]
}

>DimAngle
{
<Arrowhead [at2]
<Arrowsize [aptf]
<Size [ts]
<offset [optf]
<Pointxyz 5, 0, 0
<Pointxyz 10, 0, 0
<Pointxyz 10, 10, 0
<Pointxyz 10, 10, 0
}


>DimRadProgress
{
<Format [fmt]
<Precision [Prcn]
<Arrowhead [at2]
<Arrowsize [aptf]
<Size [ts]
<offset [optf]
<Pointxyz 10, 10, 0
<Pointxyz 20, 10, 0
<Pointxyz 35, 10, 0
<Pointxyz 50, 10, 0
<Pointxyz 50, 12, 0
}


>DimCoordinate
{
<Format [fmt]
<Precision [Prcn]
<Arrowhead [at2]
<Arrowsize [aptf]
<Size [ts]
<offset [optf]
<Pointxyz 0, 0, 0
<Pointxyz 10, 15, 0
<Pointxyz 11, 15, 0
}

>Arc4
{
<Pointxyz -10, 0, 0
<Pointxyz 0, 0, 0
<Radius 0
<Pointxyz -10,10, 0
}

>DimArc
{
<Format [fmt]
<Precision [Prcn]
<Arrowhead [at2]
<Arrowsize [aptf]
<Size [ts]
<offset [optf]
<Pointxyz 0, 0, 0
<Pointxyz 10, 0, 0
}


>DimDiameter
{
<Type 0
<Format [fmt]
<Precision [Prcn]
<Axis 0
<Arrowhead [at2]
<Arrowsize [aptf]
<Size [ts]
<offset [optf]
<Pointxyz 0, 0, 0
<Pointxyz 10, 0, 0
}


>DimRadius
{
<Format [fmt]
<Precision [Prcn]
<Axis 0
<Arrowhead [at2]
<Arrowsize [aptf]
<Size [ts]
<offset [optf]
<Pointxyz 0, 0, 0
<Pointxyz 10, 0, 0
}


>line
{
<Pointxyz 0, 0, 0
<Pointxyz 10, 10, 0
}

>DimChamfer
{
<Format [fmt]
<Precision [Prcn]
<Axis 0
<Arrowhead [at2]
<Arrowsize [aptf]
<Size [ts]
<offset [optf]
<Pointxyz 0, 0, 0
<Pointxyz 10, 0, 0
}


>Dimension
{
<Arrowhead [at2]
<Arrowsize [aptf]
<Size [ts]
<offset [optf]
<Gap [gptf]
<Overshoot [xptf]
<Format [fmt]
<Precision [Prcn]
<Location [Locn]
'<Tolerancetype 1
'<Tolerance 0.002
<Pointxyz 10, 10, 0
<Pointxyz 40, 10, 0
}

>Text
{
<Size [ts]
<Text [a$]
<Pointxyz 10, 10, 0
<Pointxyz 40, 10, 0
}

for x=1 to 23
>Eraselast
{
}
next x

sys(36)=0
regen
end
User since forever

bdeck

Quote from: Rob Schippers on January 27, 2008, 11:27:09 PM
I think it would be nice to add a user variable for the text format.

You could add a separate input statement, or just have multiple macros, one for each format.

Dunno about the wierd stuff. If you comment out the "sys(36)=2" line, you may get an error message showing you where the problem is. Could be the points are not set correctly for one of the Dimensions in V 18.

Redraw may work better than regen in 18.

Regards,

BD