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.

Using blocks in place of standard dimension arrows (hash.d3m and unhash.d3m)

Started by prl, April 28, 2014, 04:51:44 AM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

prl

A reprint from this thread http://forum.designcad.com/index.php?topic=5494.msg37979#msg37979

Hash Slash Tick Whatchamacallit 

The hash.d3m routine hides the native dimension arrow and adds a block at the locations.

The unhash.d3m routine removes all the blocks created by hash.d3m and restores the native dimension arrow.


If you repeatedly use the hash routine, you will be adding blocks on top of blocks.  Therefore I recommend you dimension as you normally would, say using the filled circle, and only run the hash.d3m routine when you want the block symbol added to the dimension lines. Otherwise use unhash.d3m and work normally. (Do the hash.d3m routine at print time and restore your drawing to normal mode using the unhash routine. )

Note I've arbitrarily put the block instances (insertions) on layer 100.   Also named the block "mytick". You can change the code to anything you want.

The file for the below graphics is http://forum.designcad.com/index.php?action=dlattach;topic=5494.0;attach=11762. The block is already made but not inserted.  Run the hash.d3m to get the results shown in the second graphic (the big blue ticks).

'program hash.d3m (add user slash block)

'4/27/2014 v1 - forum topic


'------------------------- begin user data

bname$ = "mytick"  'a user block, defined to a scale of 1
blayer = 100       'a user defined layer for where the blocks will be placed

'------------------------- end user data


dim p1x(1000), p1y(1000), p1z(1000), p2x(1000), p2y(1000), p2z(1000)
include "dcadalias.d3i"
index = 0

sys(80)=0

for i=1 to sys(9)
  entity i
  getattr i, etype, select
  if etype = 75 then 'a linear dimension
     putattr i, etype, 1
     query D_TEXTSIZE, dtsize 'store the text size and use it to scale the block
     change D_ARROWTYPE, 0 'remove the current arrowhead type
  endif
next i
sys(1)=0

'explode dimension assembly into subassemblies in order to find the arrow components
>explode
{
}

maxsel = sys(80)
for j = 1 to maxsel
  getselect j, entnum
  entity entnum
  getattr entnum, type, select, laynum, groupid, red, green, blue, solidid
 
  if type = 24 then 'then arrow part of dimension assembly
       index = index + 1
       pointval p1x(index) p1y(index) p1z(index) 1
       pointval p2x(index) p2y(index) p2z(index) 2
  endif
  sys(1)=0
next j

'restore dimensions
>undo
{
}
sys(80)=0

'now add user block to dimension
for i = 1 to index
  >blockinsert
  {
  <layer [blayer]
  <Name [bname$]
  <Type 0
  <Scale [dtsize], [dtsize], 1
  <WaitForOK 0
  <pointxyz [p2x(i), p2y(i), p2z(i)]
  <pointxyz [p1x(i), p1y(i), p1z(i)]
 
  }
next i

regen
End


'program unhash.d3m (remove user added slash block)

'4/27/2014 v1 - forum topic

'------------------------- begin user data

blayer = 100 'user defined layer for where the blocks will be placed
artype = 3   'user defined arrow head type for dimensions

'------------------------- end user data


include "dcadalias.d3i"

sys(80)=0

for i=1 to sys(9)
  entity i
  getattr i, etype, select
  if etype = 75 then 'a linear dimension
     change D_ARROWTYPE, artype
  endif
next i
sys(1)=0

>SelectLayer
{
<Layer [blayer]
<Type 0 ' default; just here for clarity
}
if sys(80) > 0 then
  >Erase
  {
  }
endif

regen
End




prl