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 0 Guests are viewing this topic.

bdeck

Here's a new front end for the macro that lets you set either the text size or format.

This way doesnt waste a hotkey, as a separate macro would if you run the macro from a keyboard shortcut. (I'm still running it from the spacebar)

Best guesses on fluky behavior in v 18, in order of likelihood.
1) DimChamfer (or some other command) may have changed, requiring more points to be set.
2) V18 may not like dimensioning arcs or chamfers from points shared with other entites
3) Axis may conflict with points and text location on one or more dimensions.

After removing sys(36)=2, did anything show up?


BD

' New front end for macro  ( remove the "fmt=0" line )
' Allows user to enter either a new size or a new format (but not both).
' Could also be used to adjust other parameters.

print "Current Text Size = ", sys(12)
input "Enter Text Size or Format ( d, f, df, or ff )",  vin$
if vin$="0" then end
if len(vin$)=0 then end
if val(vin$)>0 then
   ts=val(vin$)
   fmt=sys(101)
else
   ts=sys(12)
   fmt=-99
   if vin$="d" or vin$="D" then fmt=0  ' decimal format
   if vin$="f" or vin$="F" then fmt=1  ' fraction format
   if vin$="df" or vin$="DF" then fmt=2  ' feet and decimal inches
   if vin$="ff" or vin$="FF" then fmt=3  ' feet and fractional inches
endif          
if fmt=-99 then end



Rob S


OK, you've got me going now, I was just finished making my own version with the ability to do both text and arrow sizes and text format at the same time.

I also added the plain "arrow" function, so that my arrowheads for notations will match in size as well.  Your idea of drawing a sample dimension of each type with the desired parameters is amazing.

Now here is the weird part.  When I comment out the sys(36)=2 part, I need to increase the number of entities to erase by two, to get rid of all the dimensions it draws.  Then there is no pointing and clicking required.  There are no error messages.

If I put sys(36)=2 back, I need to reduce this number by two, or it deletes two existing items from the drawing.  Almost as if one of the commands does not like to run in silent mode.

Now, if we could find out what is the proper syntax for the baseline dimension offset between adjacent dimension lines as opposed to text offset, we would have it made.

I just tried using sys(12) for text instead of drawing text, but that does not really help.

DT - Heeeeelpppp



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

print "Current Text Size = ", sys(12)
input "Enter desired text size, 0 to end",  ts

if ts = 0 then end

fix:
input "Dimension Format -  0 = 1.500, 1 = 1 1/2,  2 = 1'6.75,  3= 1'6-3/4, 10 to end" fmt   


if fmt = 10 then end
if fmt < 0 then gosub fix
if fmt > 3 then gosub fix 


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

>Arrow
{
 
<Pointxyz 10, 10, 0
<Pointxyz 40, 10, 0
 
<Size [aptf]
 
  }


>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 25
>Eraselast
{
}
next x

sys(36)=0
regen
end
User since forever

bdeck

Rob,

Cool.  Good progress.

Ugly as our little macro may be, this method does have a certain charm, and it may ultimately be the most versatile solution, and one that wouldnt have been considered if DC had not been so screwed up   radically changed.   ;)

Wierdness:
Dimension as written may fail with the wrong user axis setting. That can be fixed by offsetting the coordinates in the command so that they are not orthogonal. (see below)   That should be done for all of the commands in the macro.

I'm just guessing here, not having v18 on the road with me.

If tweaking the coordinates doesnt help, you may be able to identify the culprit by commenting out each dim command one at a time until the sys command no longer affects the entity count.

Lucky for us DT is back in town.

Regards,

BD


>DimChamfer
{
<Format [fmt]
<Precision [Prcn]
<Axis 0              ' This is not funcitonal in version 17.2, it may cause problems in 18.1
<Arrowhead [at2]
<Arrowsize [aptf]
<Size [ts]
<offset [optf]
<Pointxyz 0, 0, 0
'<Pointxyz 10, 0, 0   ' bad second point
<Pointxyz 10, 10, 0   ' better second point
}


>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   ' bad second point
<Pointxyz 40, 11, 0    ' better second point
}

Dempsey

Rob, bdeck,

I have been looking/listening in the background. Great macro, just what I needed. To bad that I have very little time to contribute right now due to an upcoming trip.
Dempsey

Rob S

User since forever

bdeck

Rob,

Heres a stripped down version that includes most of your improvements, plus an entity counter, so that it will always erase the correct number of entities.

Tested on versions 14 and 17.2. (note 14 and 17.2 generate different number of ents for pullouts and balloons.)

I added a diagnostic counter display to the end, also.

I notice that you have access to more comlete docs than the rest of us. (Some of your commands are undocumented in my sdk.)

"Offset," which works only on baseline in versions 14 and 17 is only hinted at in the docs.  The others dont work at all in 14 and 17.

Regards




Rob S

#21
My macro was modified for V18, which uses the "offset" parameter to determine the "Text Offset" distance between the ends of the dimension line, and the text as follows:


small offset |<-- 2.00 -->|

large offset  |<-  2.00  ->|

larger offset  ->|              |<-    2.00  (Text automatically pops outside extension lines)

So, for normal dimensioning, this parameter also needs to be adjusted proportionally to the others - one more thing to set up.

Unfortunately, in doing so, the "Offset" parameter for the spacing between adjacent dimensions for baseline dimensions got STOLEN.  So for now until we can find out what the parameter for that has become, our macro does not work for Baseline spacing in V18.

I have seen other macros that check the dcad version number, so I will take a look at that, and maybe I can modify it so the "Offset" parameter is only used in V18, and ignored in V17 or lower.  Actually, it seems to be ignoring it anyway, if you can run it.

Now, I'm going to try out your new version.


1) Aha, I see you have version specific statements in there, so that will do what I was saying above.

I notice you are using the factors directly for older versions - was there a change at V17 where you enter the sizes of gaps and arrowheads directly instead of as factors??

2) Also, I don't understand how the  following statement works:

xlim=sys(9)-sys9

Would subtracting something from itself not always be 0???

3) I now realize it is the dim chamfer command that is not working in V18.  I need to click three time after the macro runs for it to finish.  When I take out dim-chamfer the macro finishes ok.  There are no error messages.
User since forever

bdeck

Quotewas there a change at V17 where you enter the sizes of gaps and arrowheads directly instead of as factors??
14 and 17 are different on arrow size.    Not sure about 15 and 16.

Quote[xlim=sys(9)-sys9
sys9 is the value of sys(9) stored at the beginning of the macro  (Sorry, I grew up in the days of short variable names.)


QuoteI now realize it is the dim chamfer command that is not working in V18. 

Maybe adding some points to the command will fix it.


Rob S


QuoteQuote
[xlim=sys(9)-sys9

sys9 is the value of sys(9) stored at the beginning of the macro  (Sorry, I grew up in the days of short variable names.)

Aaah, Soooo  :-[

I should learn to read with both eyes open!!!

Thanks.
User since forever

Dr PR

You guys are good! Ever think of rewriting the entire program in macros?
DesignCAD user since 1987

Rob S


OK, here is my latest version, many little tweaks to make it work in both 18.1 and 17.2. 

This one sets all of the dimension text size, arrow, gap, offset etc parameters and text size and arrow size proportionally and lets you choose which dimension text format you want for all of them at the same time.

If you want different proportions of gaps or arrows to text size, you just edit the factors at the top of the macro.

The only way I could get the dim chamfer to work in silent mode in V18.1 was to move it to the front of the macro.  Adding points did not help - the command just wouldn't finish. It must have been seeing a leftover point or something from a previous command.

We still need programmers assistance with the dimension spacing for Baseline dimensions in V18.  Further input or tweaks are welcome, I'm sure.
User since forever

bdeck

Rob,

Cool.

Now hose down, and have a beer.

BD.


PS: I'd be buying, but its too cold out to think about heading north.  8)

Dempsey

Great work Rob. However, my extension line was set to Fixed Length, so I added "<fix fx" (where fx = 0 for variable length) in Dimension only. Two observations:

  • All dimensions (where applicable) have now the Variable Length flag set. Weird.
  • When I use Option, Option, Dimension, and select Dim Radius Progressive, the setting changes back to Fixed Length for all the other dimensions.

The macro helps a lot, but we cannot fix gut level errors in DesignCAD itself!!!

Finally, after I run the macro I have to do one more key stroke or mouse click before I can do any real work. this is the same for V17.2 and V18.1.
Dempsey

bdeck

D,

Did you comment out the diagnostic counter at the end?

BD

Rob S


Just to keep things straight:

BDeck had the great idea of how this could be done in the first place, and deserves most of the credit.

I just tweaked it a bit, added V18 stuff, and the dimension format input part.

If we get more comments we might try to improve it some more.  It would not be too difficult to add more choices to the macro if anyone sees the need.

For example, we could add UI to choose precision, arrow type, etc, for now you can edit that part of the macro to suit yourself.
User since forever