Author Topic: Progressive Dimension Replacement  (Read 568 times)

bdeck

  • Hero Member
  • *****
  • Posts: 785
Progressive Dimension Replacement
« on: May 30, 2016, 05:56:16 PM »
Note: In version 26.1, DC substantially improved its handliing of progressive dimensions. This macro is for use only in DC versions 18.0 - 26.0

Here's a replacement for the DC progressive dimension command. By forcing corruption of arrows and correcting the arrow direction of corrupted arrows, it prevent later corruption that now occurs when copying the progressive dimensions or when copying or saving the drawing in DC versions 18 - 26.0.  Does not prevent corruption of dimensions exported to dxf or dwg.

Code: [Select]
' dp.d3m  dimension progressive       bd 5/30/2016   

' Simple replacement for DC progressive dimension command.
' Seems to prevent later corruption of arrow direction when copying, saving.
' Does not prevent corruption of dimensions exported to dxf or dwg.
' Requires version 18.2 - 26.0

Alias ENT_SELECTED  &H010C
Alias ENT_NPTS  &H010D 
Alias ENT_POINT  &H010E 
Alias ENT_TYPE  &H0101

Alias D_ARROWTYPE &H0A01
Alias D_EnableSecondArrow &H0A17
Alias D_ArrowType2 &H0A16
Alias D_TEXTPOSITITION_HOR &H0A15
Alias D_TEXTPOSITION_VER &H0A14
Alias D_ENABLEFIXEDTEXTPOS &H0A18
Alias D_SETTEXTFLIPPED &H0A19

gosub checkversion

ne0=sys(9)   ' number of entities in drawing at outset

tsz = 0  'text size
asz = .8   'arrowhead size
xlos= 0.25   'extension line overshoot (fraction of tsz)
xlgap= 1
toff= 0.4   ' text offset from extension line or dim line

ah1 = 3   'use 3,6, or 7
ah2 = 4   'use any number from 1-12 except 3,6, and 7 (eg 1,2, or 4)
htp= 4    ' horizontal text posn, 2= perp to right (second) extension line, 4 = parallel to right (second) extension line
vtp= 0    ' vertical Text Posn 0=centered, 1=above, 2=below (exline or arrows)
  ' never use 0 when htp = 1 or 2

>DimProgress
{
if tsz>0 then
<Size [tsz]
endif
<Arrowsize [asz]
<OverShoot [xlos]
<Gap [xlgap]
<OptDimTextOffset  [toff]
<Fix 0
<EnableSecondArrow 1
<Arrowhead [ah1]
<Arrowhead2 [ah2]
<DimHorizontalTextPos  [htp]   
<DimVerticalTextPos    [vtp]
<incomplete
}

ne1=sys(9)      'number of entities after drawing dimension

if ne1<=ne0 then end

>DeSelect    ' deselect any prior selection
{
}

gosub Fixall

end


FixAll:
nfix=ne0+1
entity nfix
query D_TEXTPOSITITION_HOR  htpq
if htpq<>htp then    ' is this cluster of dims susceptible to corruption?
for n=nfix to ne1
entity n
change ENT_SELECTED 1
update
next n
gosub dupit  ' make 2 generations of copies to corrupt the arrowheads
for n=nfix to ne1    ' change the corrupted arrow heads
entity n
change D_ArrowType ah2
change D_ArrowType2 ah1
update
next n
for n=nfix to ne1 ' select the entire cluster of dims for redraw
entity n
change ENT_SELECTED 1
update
next n
>Move              'trick to achieve rapid redraw without redrawing entire screen
      {
        <Type 0
          <Reference 1
          <Pointxyz 0, 0, 0
            <Pointxyz 0, 0, 0
      }
>DeSelect 'deselect after moving
{
}
endif
return

dupit:  ' copy then duplicate cluster of progressive dims to force corruption of arrows
>SetHandle
{
<Type 0
<Pointxyz 0, 0, 0
}
>Copy
{
}
>Erase  'erase source
{
}
>Paste
{
<Type 1
<SelectOnly 1
<Pointxyz 0,0,0
}
>Duplicate
{
<Type 0
  <Reference 1
  <Pointxyz 0, 0, 0
    <Pointxyz 0, 0, 0
}
>Erase  'erase prior copy
{
}
return

checkversion:
verno$=sys$(105)
if verno$<"18.2" then
message "DP macro requires DC version 18.2 or later."
end
endif
return
« Last Edit: March 08, 2017, 09:07:08 AM by bdeck »

samdavo

  • Hero Member
  • *****
  • Posts: 2587
  • the trick is knowin...^ > v < - which way's up?
Re: Progressive Dimension Replacement
« Reply #1 on: June 02, 2016, 01:06:49 AM »
Well done m8, - we'll have to invent a classification called a "super-hero" member :)

bdeck

  • Hero Member
  • *****
  • Posts: 785
Re: Progressive Dimension Replacement
« Reply #2 on: June 02, 2016, 03:26:36 PM »
Well done m8, - we'll have to invent a classification called a "super-hero" member :)

Hi Sam,
Thanks. Sounds intriguing.
But I'm not sure how good any of us would look in a leotard.      ;)
bd

samdavo

  • Hero Member
  • *****
  • Posts: 2587
  • the trick is knowin...^ > v < - which way's up?
Re: Progressive Dimension Replacement
« Reply #3 on: June 02, 2016, 05:13:18 PM »
off thread ...
for some reason I am reminded of Lothar - Leotards with shorts and a cummerbund lol.  Plus a potplant hat.

PS Here's another superhero at work :)   adriank's work with rendering !!!  Fan-bludy-tastic  -  I believe that Mandrake the Magician would be more relevant that Lothar's leotards :) 

bdeck

  • Hero Member
  • *****
  • Posts: 785
Re: Progressive Dimension Replacement
« Reply #4 on: June 05, 2016, 07:26:25 AM »
PS Here's another superhero at work :)   adriank's work with rendering !!!

Very slick. I wonder how the Phong rendering would look with better lighting. Too bad light control in DC is so dreadful. Hats off to adriank for illuminating an alternative.