Author Topic: Dimension Replacement  (Read 438 times)

bdeck

  • Hero Member
  • *****
  • Posts: 780
Dimension Replacement
« on: October 24, 2015, 03:37:21 PM »
Design Cad's dimension format was changed drastically in version 18.

With that change DC added some dramatic improvements to the dimension drawing process, with the downside that dimensioning in DC now sometimes requires a bit of extra attention from the user. 

For example, the behavior of DC when drawing an "@" style dimension differs markedly from its behavior when editing the same dimension. This has to do with the odd implementation of the "movement" parameter of the Dimension command.

Here are two macros that work around that behavior to simplify the drawing and editing process.

dd.d3m (Draw Dimension) is a complete replacement for the "@" dimension command.  I assign mine to the alpha "2" key (unshifted "@").

dink.d3m simply toggles the selected dimension(s) between "Movement: no leader" and "Movement: Dim line with text"

Run the dd.d3m macro and set 3 points. Then set a 4th point for the text position, or hit the return key or click the gravity button (RMB) to lock the text position to the location of the 3rd point.

Next time you want to use the mouse to alter the text location of that same dimension, the text and dimension line will move together correctly, just as when the dimension was originally drawn.

Occasionally, if  a dimension is drawn with arrows and text outside the extension lines, DC will put an unwanted line through the text. To eliminate the line, run dink.d3m once. (This will eliminate the stray line, but make the dimension more difficult to edit later. To make the dimension more easily editable again, run the dink.d3m macro again. Dink is a simple toggle, and can be run as many times as desired)

Code: [Select]
' DD.d3m  Draw Dimension dimension so that text position and dimension line move together
' during both the initial drawing and subsequent editing

Alias D_ENABLEFIXEDTEXTPOS &H0A18

ne0=sys(9)  ' archive number of entities

>Dimension

{
<TextMovement 2
<incomplete 
}

ne=sys(9)

if ne>ne0 then   ' is there a new entity?
getattr ne,type
if type=75 then gosub fixit  ' is the entity a simple @ style dimension?
endif

end

fixit:
entity ne
change D_ENABLEFIXEDTEXTPOS,1
update
regen
return


Code: [Select]
' Dink.d3m  Dimension Increment  Bdeck  10/ 2015
' Toggles selected dimension(s) between "Movement: no leader" and "Movement: Dim line with text"
' Necessary to remove stray dimension line extensions in DC versions 18-25
' If no dimension is selected, acts on last drawn entity, if it is a dimension.


Alias D_ENABLEFIXEDTEXTPOS &H0A18
Alias ENT_SELECTED  &H010C

ne=sys(9)
ns=sys(80)

if ns=0 then           'toggle last entity drawn
entno=sys(9)
gosub checkit
regen         'optional
end
endif

for entno=1 to ne
entity entno
query ENT_SELECTED, isselected
if isselected = 1 then gosub checkit
next entno
regen           'optional
end

checkit:
getattr entno,type
if type=75 then gosub fixit
return

fixit:
entity entno
query D_ENABLEFIXEDTEXTPOS,isfixed
refixed=1-isfixed
change D_ENABLEFIXEDTEXTPOS,refixed
update

return
 

« Last Edit: April 02, 2016, 09:21:07 AM by bdeck »