find arc center after import from dxf

48 views
Skip to first unread message

Manuele

unread,
Mar 29, 2011, 4:46:32 AM3/29/11
to MetaDraw Developers Group
Hello,
I'm running metadraw v.2.0.16.1
After importing a dxf drawing that contains an arc object I need to
know the center point of the arc.

Although the dll provides only the starting and ending points.

Point
ptStart=((Point[])mdisegno.ObjGetParams(0, 1, CoordType.Logic))[0];
Point ptEnd =
((Point[])mdisegno.ObjGetParams(1, 1, CoordType.Logic))[0];

These informations are not enought to define the center of the arc.
Does anyone knows how to know the center of the arc?????

Thanks a lot
Manuele

Manuele

unread,
Aug 3, 2011, 1:29:52 PM8/3/11
to metadraw-for...@googlegroups.com
I asked Metadraw support and they gave my the solution:
I'm now using it and it works fine:
Here is what they suggested:

What you can do is to

a) create a duplicate copy of the arc
- Use the Action method with parameter Duplicate

.Action(BTIS.MetaDraw.Actions.Duplicate)

After the duplication .Current now points to the
copy

b) convert the copy to a Ellipse object
- set ObjType property to Ellipse

.ObjType = BTIS.MetaDraw.ObjectTypes.Ellipse

The Ellipse that is created will be the full ellipse
that the arc is part of


c) find the center of the Ellipse as

x0 = (.ObjLeft + .ObjRight) / 2
Y0 = (.ObjTop + .ObjBottom) / 2

d) Delete the Ellipse

.RemoveObject(BTIS.MetaDraw.ObjHandle.Current)

Note, in your DXF, you had the arc as part of a container.
You must make sure that when you start the above, that .CURRENT
points to the ARC object, not to a container.
Reply all
Reply to author
Forward
0 new messages