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.

Area Dimension of polygon/plane

Started by aqua, December 10, 2006, 03:41:29 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

aqua

Can we have a new feature in Designcad for the area dimension of a Polygon/Plane.
Also want the area text location & result to be upgraded if one changes the shape of the Polygon/Plane


Regards FM

The macro below adds a polygon and the area of text as the centre of gravity.
However, if you change the shape, the text location and result is not updated

Designcad 13


'FTM-2/12/2006
el = sys(3)
layer(107)=6
layer(122)=6
Dim X(200)
Dim Y(200)
Dim Z(200)
offset = 50000
a =0
a=sys(120)
b=0
b=sys(121)
c=0
c=sys(122)
d=0
d=sys(123)

size$ = 15
if sys(9) > 0 then size$ = 0.0125 * Sqrt((c-a)*(c-a) + (d-b)*(d-b))
size2 = size$
if size2 = 0 then size$ = 15
size2 = size2 * 2

looper:
Sys(41) = 13
'turn off dialog box
sys(244)=1
sys(80)=0
sys(36)=0
sys(1)=0
SetPoint "Set points for polygon fence, press enter to complete or esc to end:" 200
If Sys(1) < 3 Then
Sys(41)=0
Sys(244)=0
sys(3)=el
End
endif

npts = sys(1)
For i = 1 to npts
   Pointval x(i) y(i) z(i) i
next i


sys(3)=107
>Plane
{
  For i = 1 to npts
   <PointXYZ [x(i),y(i),0]
  Next i
  <Type 1
}

Sys(36) = 1
sys(1)=0
>plane
{
for i = 1 to npts
<pointxyz [x(i)+offset, y(i), 0]
next i
}

'use a dummy pointmark to find the cg of the plane
>pointmark
{
<cg [x(1)+offset, y(1), z(1)]
}

entity sys(9)
pointval xcg, ycg, zcg, 1
sys(1)=0

xcg = xcg - offset

'the dummy pointmark
>eraselast
{
}

'the dummy plane
>eraselast
{
}

'Measure and add area text
>Area
{
  For i = 1 to npts
   <PointXYZ [x(i),y(i),0]
  Next i
  <Type 1
  }

Precision 2
a = 0
a = sys(655)
if a = 0 then end
'Convert to hectares
b = 0
b = a/10000
Text$ = b, "h"

sys(3)=122
>ID_TEXT3D
{
<pointxyz [xcg-size2, ycg, zcg]
  <Style 0
  <Justification 0
  <Size [Size$]
  <Angle 0.0000
  <Font "Arial"
  <Text [Text$]
  }
goto looper