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.

Identify points of a circle or arc

Started by aqua, July 11, 2008, 04:22:36 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

aqua

Designcad 13.13

I am trying to change the width of existing circles or arcs
I am deleting the existing circle/arc, then adding a new one.
However, I need a way to identify whether it is a full or part circle arc.
And then add a new circle with an identical arc.

Does anyone know how to do this?






'FTM-11/7/2008
'Need to ensure identify arcs or circles, at the moment it turns part arcs into full circle
'Identify Radius, start angle, span angle, length?
sys(80)=0
SetPoint "Set a point to identify pivot tracks to explode, press Esc to end: ", 1
If Sys(1) < 1 Then End
Pointval x1 y1 z1 1
>PointSelect
{
  <PointXYZ [x1,y1,0]
  <Type 0
  }

for j = 1 to sys(80)
GetSelect j, k 'store the entity id of selected entity j in k
Entity k
    getattr k, type, select, layr, group, red, green, blue
if layr <> 207 then
if layr <> 210 then
Message "This item is not on the pivot tracks layer. Please check the items layer"
sys(80) = 0
end
end if
end if

if layr = 207 then layr = 211
if layr = 210 then layr = 211
  putattr k, type, select, layr, group, red, green, blue
  next

>GroupExplode
{
  }
sys(3)=211
sys(80)=0


Input "Enter wheel track line thickness, example 1, suggest 5 for images:", Trackthickness$

sys(3)=211

'For all items in the drawing, would prefer to look at only layer 211 items
'When erasing items, code can be an issue, I think we need the sys(9) and step - 1 stuff
OrgCount = Sys(9)
For i = OrgCount to 1 Step -1
Entity i
    getattr i, type, select, layr, group, red, green, blue

Pointval x1 y1 z1 1
Pointval x2 y2 z2 2
'Pointval x3 y3 z3 3
'Pointval x4 y4 z4 4
end if

if type = 16 then radiussize = sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1))
'Type 1 = Line , Type 4 = Curve, Type 16 = Circle, Type 17  = Hatch
    If type = 16 And layr = 211 and radiussize > 20 then
        Gosub fixup
    End If
Next i
sys(3)=207


>SelectLayer
{
    <Layer 211
}
If Sys(80) <> 0 Then ' if layer is NOT empty, do some stuff
for j = 1 to sys(80)
GetSelect j, k 'store the entity id of selected entity j in k
Entity k
    getattr k, type, select, layr, group, red, green, blue
if layr = 211 then layr = 207
  putattr k, type, select, layr, group, red, green, blue
  next
>GroupDefine
{
  }

sys(80)=0
end if
End


' Subroutine fixup
fixup:
Entity i
Pointval xc yc zc 1
Linetypefm = Sys(91)
Sys(1) = 0 ' clear points
Sys(80) = 0 ' clear selection (just in case)
PutAttr i, 16, 1 ' select the point mark, then erase it
>Erase
{
}

'Need to identify group
'Select item when created

>Circle4
{
<LineStyle [Linetypefm,20.0000,Trackthickness$]
<Color [red,green,blue]
<Type 0
<Radius [radiussize]
<Pointxyz [x1, y1, 0]
<Pointxyz [x2, y2, 0]
'<Pointxyz [x3, y3, 0]
'<Pointxyz [x4, y4, 0]
}

sys(80)=0
Return

bdeck

QuoteHowever, I need a way to identify whether it is a full or part circle arc.

Hi Aqua,

Using APW.d3m, http://forum.designcad.com/index.php?topic=130.0 , it appears that points 2 and 3 of a full circle are identical.

Points 2 and 3 of an arc are not identical.

Hope this helps

BD

aqua

BD

The solution was >Arc4, not >Circle4
I don't bother finding out whether it is a circle or arc,  just recreate them as arcs
An thus - as you suggest - point 3 is identical to point 2, which creates a circle out of the arc.

Regards Frank