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.

Adding material list as text

Started by aqua, November 22, 2007, 01:59:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

aqua

Designcad 13

The macro listed below adds the material list as text.


When it adds the material list, it will add the text exactly as per the file: i.e.

     1,150 mm x 50mm Tapping Band

Does anyone know the code to replace the , with spaces: i.e.

     1   150 mm x 50mm Tapping Band


Regards Frank

'FTM-19/11/2007
layer(221)=6
layer(222)=6
sys(80)=0
>selectlayer
{
<Layer [221]
<Layer [222]
}
if sys(80)=0 then
Message "There are no Pod line layouts or materials in the attached drawing. Please add your Pod line layouts."
end
endif

sys(80)=0
Message "Please click SAVE, then click on (Pod line material list.lst) in C:\Program Files\Aquaflow\Projects, then SAVE again, then YES to overwrite existing, then EXIT:"
>MaterialList
{
  }
a=0
a=sys(120)
b=0
b=sys(121)
c=0
c=sys(122)
d=0
d=sys(123)

size$ = 0.006 * Sqrt((c-a)*(c-a) + (d-b)*(d-b))
size2 = size$
if size2 = 0 then size$ = 15

size3 = (0 - size2)*2
if size2 = 0 then end
sys(36)=0
'
'Pipe details to write pod material count into CAD drawing as text
el = sys(3)
open "i", 1, "c:\Program Files\Aquaflow\Projects\Pod line material list.lst"


sys(80)=0

>selectlayer
{
<Layer [221]
}
>Selectdelete
{
}

SetPoint "Set point for Top Left Corner of the text box", 1
If Sys(1) < 1 Then End
Pointval x1 y1 z1 1
y2 = 0
y2 = y1-size2
>SetStartPoint
{
  <PointXYZ [x1,y2,0]
}


Sys(36) = 1
size4$=(0 - size2)*2
sys(3)=221
>ID_TEXT3D
  {
  <PointXYZ [size2 * 1.5],[-size3],0.0000
  <Style 0
  <Justification 0
  <Size [size$]
  <Angle 0.0000
  <Font "Arial"
  <Text "POD LINE MATERIAL LIST"
  }


do while eof(1)=0
size4$=(0 - size2)*2
>SetStartPoint
{
  <PointXYZ 0,[size4$],0
}
Input #1, name$
Text$ = name$
sys(3)=221
>ID_TEXT3D
  {
  <PointXYZ 0,[-size3],0.0000
  <Style 0
  <Justification 0
  <Size [size$]
  <Angle 0.0000
  <Font "Arial"
  <Text [Text$]
  }
sys(3)=el
loop
sys(3)=el
>Regenerate
{
  }
Sys(36) = 0
Close #1
End

prl

#1
Added the code in blue.


'FTM-19/11/2007

wrong$=","
replace$ = "   "



layer(221)=6
layer(222)=6
sys(80)=0
>selectlayer
{
<Layer [221]
<Layer [222]
}
if sys(80)=0 then
Message "There are no Pod line layouts or materials in the attached drawing. Please add your Pod line layouts."
end
endif

sys(80)=0
Message "Please click SAVE, then click on (Pod line material list.lst) in C:\Program Files\Aquaflow\Projects, then SAVE again, then YES to overwrite existing, then EXIT:"
>MaterialList
{
  }
a=0
a=sys(120)
b=0
b=sys(121)
c=0
c=sys(122)
d=0
d=sys(123)

size$ = 0.006 * Sqrt((c-a)*(c-a) + (d-b)*(d-b))
size2 = size$
if size2 = 0 then size$ = 15

size3 = (0 - size2)*2
if size2 = 0 then end
sys(36)=0
'
'Pipe details to write pod material count into CAD drawing as text
el = sys(3)
open "i", 1, "c:\Program Files\Aquaflow\Projects\Pod line material list.lst"


sys(80)=0

>selectlayer
{
<Layer [221]
}
>Selectdelete
{
}

SetPoint "Set point for Top Left Corner of the text box", 1
If Sys(1) < 1 Then End
Pointval x1 y1 z1 1
y2 = 0
y2 = y1-size2
>SetStartPoint
{
  <PointXYZ [x1,y2,0]
}


Sys(36) = 1
size4$=(0 - size2)*2
sys(3)=221
>ID_TEXT3D
  {
  <PointXYZ [size2 * 1.5],[-size3],0.0000
  <Style 0
  <Justification 0
  <Size [size$]
  <Angle 0.0000
  <Font "Arial"
  <Text "POD LINE MATERIAL LIST"
  }


do while eof(1)=0
size4$=(0 - size2)*2
>SetStartPoint
{
  <PointXYZ 0,[size4$],0
}
Input #1, name$
text$ = name$

totlen=len(text$)
n=instr(text$,wrong$)
text1$=left$(text$,(n-1))
text2$=right$(text$,(totlen-n))
text$=text1$ + replace$ + text2$



sys(3)=221
>ID_TEXT3D
  {
  <PointXYZ 0,[-size3],0.0000
  <Style 0
  <Justification 0
  <Size [size$]
  <Angle 0.0000
  <Font "Arial"
  <Text [Text$]
  }
sys(3)=el
loop
sys(3)=el
>Regenerate
{
  }
Sys(36) = 0
Close #1

aqua

PRL

Thanks - worked well

"An ouce of brains is worth a ton of energy"

Regards Frank