News:

Please note new Forum URL: forum.designcad.com

Main Menu
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 Dimension

Started by GooPie, March 10, 2015, 08:27:37 AM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

GooPie

Good Morning,

The following macro is used to rate the perimeter of a polyline simply by clicking the endpoints of the polyline.
This macro works perfectly and makes me gain time because unlike the dimension function DesignCAD it is not necessary to click the starting point and the ending point each time. Simply click the endpoints of the polyline one after the other.

The reason I am asking your help is that I would like all dimensions are listed on the outside of the perimeter of the polyline.
Whereas now with this macro, the dimensions are sometimes draw inside this perimeter and sometimes outside.

With the instruction "DimensionDistanceOnly" I should be able to impose a Location 1 (outside the perimeter ) or Location 2 (inside the perimeter) based on the difference delta X, but I do not know how. And I turn in round since too long.

This is my 3rd macro, thank you to forgive my mistakes.

'Multiple Dimension.d3m
SYS(996) = 1 ' PRESS ESC TO QUIT

DIM x(200)
DIM y(200)
DIM z(200)

SETPOINT "SET 2 Points." 2

POINTVAL x(1) y(1) 1
POINTVAL x(2) y(2) 2

dx = x(2) - x(1)
'delta x


NUMPTS = 2

IF dx<0 THEN
Location$ = 2
END IF

IF dx>0 THEN
Location$ = 1
END IF

>DimensionDistanceOnly
{
  <POINTXYZ [x(1), y(1)]
  <POINTXYZ [x(2), y(2)]
  <Axis 1
  <Orientation 0
  <Precision 2
  <Format 0
  <Location [Location$]
  <Font "Arial"
  <FontType 0
  <Size 1.2
  <Type 0
  <Fix 0
  <Gap 1.0
  <Length 2.0
  <OverShoot 5.0
  <Arrowhead 4
  <ArrowSize 1.0
  <LinePosition 0
  <Multiplier 0
  }

SETPOINT "SET Next Point. Press ESC to Quit " 1

Do while sys(1) = 1 AND NUMPTS <= 200

NUMPTS = NUMPTS + 1

POINTVAL x(NUMPTS) y(NUMPTS) 1

dx2 = x(2) - x(NUMPTS)
' delta x


IF dx2<0 THEN
Location2$ = 2
END IF

IF dx2>0 THEN
Location2$ = 1
END IF

>DimensionDistanceOnly
{
  <Color 0,0,0
  <Layer 4
  <POINTXYZ [x(NUMPTS-1), y(NUMPTS-1)]
  <POINTXYZ [x(NUMPTS), y(NUMPTS)]
  <Axis 1
  <Orientation 0
  <Precision 2
  <Format 0
  <Location [Location2$]
  <Font "Arial"
  <FontType 0
  <Size 1.2
  <Type 0
  <Fix 0
  <Gap 1.0
  <Length 2.0
  <OverShoot 5.0
  <Arrowhead 4
  <ArrowSize 1.0
  <LinePosition 0
  <Multiplier 0
  }

SETPOINT "SET Next Point. Press ESC to Quit " 1

LOOP

END

GooPie

I don't know if my request was well formulated.
To be more precise, I have attached a drawing example.
In this example, on the left: the dimensions with my macro by clicking successively on points 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 and 1. I want these dimensions (in red) came to outside the perimeter 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 1.

Thank you for help

Dempsey

Hi,

I don't have the answer, but the documentation says that the third point is for the dimension text location:

Quote
>DimensionDistanceOnly

{

<Orientation o

Text orientation [0 = aligned with arrows, 1 = perpendicular, 2 = horizontal, 3 = vertical]

<Precision p

Number of digits past the decimal in the dimension text

<Format f

Text format [0 = 4.125, 1 = 4-1/8, 2 = 4'1.5", 3 = 4'1-1/2"]

<Location l

Text location relative to arrows [0 = inside, 1 = outside]

<ToleranceType tt

[0 = none, 1 = single value, 2 = high/low values]

<ToleranceSize ts

relative size of tolerance text

<ToleranceLow tl

low tolerance value for tolerance type 2

<ToleranceHigh th

high tolerance value for tolerance type 2

<Tolerance tv

tolerance value for tolerance type 1

<Suffix i$

dimension suffix ["0" = none, "1" = custom1, "2" = custom2, etc.]

<Prefix "j$

dimension prefix ["0" = none, "1" = custom1, "2" = custom2, etc.]

<Font "fontname"

the full name of the Windows font, e.g.: "Times New Roman"

<VectorFont vfont$

the name of the desired vector font, ex. "Simplex_Win"

<FontType ft

the font type [0=TrueType, 1 = Vector]

<Size s

dimension text size

<Type t

[0 = dimension, 1 = exploded dimension]

<Axis y

[1 = horizontal, 2 = vertical]

<Text fixed$

If present, sets the fixed dimension text

*New parameters added in Version 15
<Multiplier m [-1 (and any value <= 0) = off, any positive value turns it on]
<PrefixText p$
<SuffixText s$
<Points: 1, 2 = distance to measure, 3 = text location

}

Notes:

- <Prefix and <PrefixText are mutually exclusive. If both parameters are used in the same command, the one used last will overrule the previous one.

- Once the <PrefixText is used in the command section, it will overrule the drop-down list selection by the user. (However, it will NOT update the text in the list selection)

- <Suffix and <SuffixText are mutually exclusive. If both parameters are used in the same command, the one used last will overrule the previous one.

- Once the <SuffixText is used in the command section, it will overrule the drop-down list selection by the user. (However, it will NOT update the text in the list selection)

Compatibility: All versions. Multiplier, PrefixText, and SuffixText parameters only exist in Version 15 and higher.

Example:

>DimensionDistanceOnly
{

<Pointxyz 0, 0, 0
<Pointxyz 10, 10, 0
<Pointxyz 10, 15, 0

}

Hope this helps.
Dempsey

bdeck

Hi GooPie,

What version of DC are you using?

Later versions differ from earlier versions in the way thy handle the Dimension parameters.

bd


GooPie

Dempsey,

Yes I know that the third point is for the dimension text location.
But precisely, I want to avoid this third point.
The goal is to have all dimensions automatically outside.
I think it is possible by calculating the delta X points and the delta Y points.
Then with the IF function to impose Location.

bdeck,

I use a French version DesignCadPro 6000.
I think this is the version 15 or 16.

GooPie

#5
With basiccad, it is possible a double condition ?

If ... and If ... then

I still learned something today
IF ... And IF... THEN

samdavo

#6
Personally I would just select all offending dimensions, explode them  ... and move the text (numbers) to the outside ...

perfect? - no
good enough for a blind man on a galloping horse? - I would have thought so.  (2 cents)

PS As for the double condition,  here's an example of a triple condition - from one of prl's macros ...
cheers

Quoteif ODD(y)=1 and ODD(y\2)=1 and ODD(y\4)=0 then 'layer has entities, is visible, is locked
Layer(i) = 6 'make layer visible and unlocked
endif

samdavo

#7
Quote from: GooPie on March 10, 2015, 08:27:37 AM
... Simply click the endpoints of the polyline one after the other.

GooPie
I find I have to click the first point once, then the second and subsequent points twice ...
Then select all dimensions ( in InfoBox), and change text size etc.
Still, it's a handy macro (as you say)
cheers
sam

PS prl's macro below (pcw.d3m) works better (for me anyway) - but (imo) needs an input for text size and precision.  Then the offset has to be juggled, depending on the quadrant etc etc (2 cents)

prl

#8
You will need to compute the 3rd point.  I could have done this with vector math but I cheated and let DesignCAD do it with the >perpendicularlinefrom command.

A movie - Dimension distance placing text to the outside using a clockwise convention

The code for the above movie is below. Note, pcw.d3m may not be perfect and there may be errors or missing conditionals in the quadrant text placement checks, specifically whether some of the checks should be >= in place of > etc.

but it gives you the general idea

. . . and it worked on my sample test drawing.  So good enough . . . as they say.  :)

'Program: pcw.d3m (perimeter clockwise)

setpoint "set 2 points." 2

pointval x1 y1 1
pointval x2 y2 2

textsize = 1.2

sys(1)=0

nextpoint:
'determine text placement point, use perpendicularlinefrom command to do this

offset = .1

xm = (x2+x1)/2
ym = (y2+y1)/2

if x2 > x1 and y2 > y1 then 'first quadrant
   offset = -.1
   tpf = .1
   'message "first quadrant"
endif
 
if x2 < x1 and y2 > y1 then 'second quadrant
   offset = -.1
   tpf = 2
   'message "second quadrant"
endif

if x2 < x1 and y2 < y1 then 'third quadrant
  offset = -.1
  tpf = 2
  'message "third quadrant"
endif

if x2 > x1 and y2 < y1 then 'fourth quadrant
  offset = .1
  tpf = .1
  'message "fourth quadrant" 
endif

sys(36)=2
>PerpendicularFrom
{
<Length [tpf*textsize]
<SelectOnly 0
<POINTXYZ [xm, ym]
<POINTXYZ [xm+offset, ym+offset]
}

Entity Sys(9) ' Get the points for the line just drawn.

' only need the second points
tp=sys(1)
Pointval xt  yt  zt  tp
sys(1)=0

>EraseLast 'remove the perpendicular line
{
}
sys(36)=1

>DimensionDistanceOnly
{
  <POINTXYZ [x1, y1]
  <POINTXYZ [x2, y2]
  <POINTXYZ [xt, yt]
  <Axis 1
  <Orientation 0
  <Precision 2
  <Format 0
  <Location 1
  <Font "Arial"
  <FontType 0
  <Size [textsize]
  <Type 0
  <Fix 0
  <Gap 1.0
  <Length 2.0
  <OverShoot 5.0
  <Arrowhead 4
  <ArrowSize 1.0
  <LinePosition 0
  <Multiplier 0
  }
sys(36)=0 

setpoint "Set next point. Press esc to quit ", 1

if sys(1)=0 then
   End
else
   x1 = x2
   y1 = y2
   pointval x2 y2 1
   sys(1)=0
endif

goto nextpoint

End

prl

Quote from: samdavo on March 11, 2015, 02:22:32 AM
PS prl's macro below (pcw.d3m) works better (for me anyway) - but (imo) needs an input for text size and precision.  Then the offset has to be juggled, depending on the quadrant etc

The baton has been handed to Sam and GooPie . . . . drum roll . . . . . .

GooPie

PRL, I study your code when I have some time.
Your approach is smart.

What software do you use to make the movie?


samdavo, enter to the size and precision is not very important for me at this moment because the PRL macro is not yet perfect  ;)

prl

#11
Quote from: GooPie on March 11, 2015, 12:17:31 PM
What software do you use to make the movie?

BB FlashBack Express 4.1.10 (Freeware).  Easy and very small self-contained (controls embedded and master *.html not required) flash files.

samdavo

#12
Clearly it is dead simple to input text size and precision,
but it seems the quadrants and the offsets require some care
...  later.  (meanwhile this blind man and his horse continue to gallop along)

PS - clearly also, to get to the bottom of it (in terms of offsets etc) would force one to fully understand those subtle points about dimensions, that I tend to skip over.  Such questions as
*  what is the "best" (and/or default) offset for text size 20?  Seems I use anything from 5 to 10
*  the best gap (again 5 to 10)
*  the best overshoot (ditto)

prl

Quote from: samdavo on March 11, 2015, 12:49:58 PM
. . . would force one to fully understand those subtle points about dimensions, that I tend to skip over.  Such questions as

Dimensions and the many way folks want to see them are the bane of all CAD programs.  So they created a million settings to let everyone shoot themselves in the head, arm, foot, toe, front, back, etc.

GooPie

I analyzed the macro of PRL and it allows me to learn.
Basiccad is indeed very addictive as you have already said to me.
The advantage of a macro is to save time.
In this case I am more and more convinced that the best way is to use the Dimension tool DesignCad and F12 key
With this macro to which I myself asked for help is probably trying to reinvent the wheel.
In practice the dimensions can not be always above or always below.
I should perhaps stop torturing my mind.

:) :) :) :) :) :)