Visual Basic Customization

Visual Basic Customization

Reply

convert Ellipse to polyline

705 Views, 4 Replies
06-03-2005 11:08 AM
I need to convert an ellipse to a polyline in AutoCAD 2000 vba but an
ellipse can't be exploded. When AutoCAD 2000 saves the ellipse as an r12 DXF
it is converted to a 3d-polyline. How do I do the same?

Set sset = .SelectionSets.Add("ConvertEllipse")

grpCode(0) = 0: grpValue(0) = "ellipse"
sset.Select acSelectionSetAll, , , grpCode, grpValue
If sset.Count > 0 Then
For Each ssItem In sset

If ssItem.ObjectName = "AcDbEllipse" Then ????

Next
End If


thanks
LJB

Re: convert Ellipse to polyline

06-05-2005 11:45 PM in reply to: *ljb
Try this.

I hope that this is tat you need.

Ciao

GPaolo





Function HMelliarc(ByVal SemiAxisMajor As Double, ByVal SemiAxisMinor As
Double)AS AcadLWPolyline

Dim LWpoly As AcadLWPolyline

Dim I As Integer

Dim J As Integer

Dim SinArc As Double

Dim aini As Double

Dim afin As Double

Dim Pnt(2) As Double

Dim Center(2) As Double

Dim Rapp As Double

Dim Vertex(2162) As Double

Dim MyInd As Long = -1

aini = 0.0

afin = TwoPI()

SinArc = afin / 720.0

Rapp = SemiAxisMinor / SemiAxisMajor

'*******************************************************

'''''''' G E S T I O N E E L L I S S I

'*******************************************************

For J = 0 To 720

Pnt(0) = (SemiAxisMajor * Cos(aini))

Pnt(1) = (SemiAxisMajor * Sin(aini)) * Rapp

Pnt(2) = 0.0

MyInd += 1

Vertex(MyInd) = Pnt(0)

MyInd += 1

Vertex(MyInd) = Pnt(1)

MyInd += 1

Vertex(MyInd) = Pnt(2)

aini += SinArc

Next J

LWpoly=THISDRAWING.MODESSPACE.ADDLWPOLYLINE .........

HMELLIARC=LWpoLY

END FUNCTION

"ljb" <.> ha scritto nel messaggio news:4865118@discussion.autodesk.com...
I need to convert an ellipse to a polyline in AutoCAD 2000 vba but an
ellipse can't be exploded. When AutoCAD 2000 saves the ellipse as an r12 DXF
it is converted to a 3d-polyline. How do I do the same?

Set sset = .SelectionSets.Add("ConvertEllipse")

grpCode(0) = 0: grpValue(0) = "ellipse"
sset.Select acSelectionSetAll, , , grpCode, grpValue
If sset.Count > 0 Then
For Each ssItem In sset

If ssItem.ObjectName = "AcDbEllipse" Then ????

Next
End If


thanks
LJB
*Laurie Comerford
Post 3 of 5

Re: convert Ellipse to polyline

06-06-2005 11:51 PM in reply to: *ljb
Hi,

Before proceeding further with your programming here, you may care to study
the "pellipse" system variable.


--

Regards,


Laurie Comerford
www.cadapps.com.au

"GPaolo" wrote in message
news:4865982@discussion.autodesk.com...
Try this.

I hope that this is tat you need.

Ciao

GPaolo





Function HMelliarc(ByVal SemiAxisMajor As Double, ByVal SemiAxisMinor As
Double)AS AcadLWPolyline

Dim LWpoly As AcadLWPolyline

Dim I As Integer

Dim J As Integer

Dim SinArc As Double

Dim aini As Double

Dim afin As Double

Dim Pnt(2) As Double

Dim Center(2) As Double

Dim Rapp As Double

Dim Vertex(2162) As Double

Dim MyInd As Long = -1

aini = 0.0

afin = TwoPI()

SinArc = afin / 720.0

Rapp = SemiAxisMinor / SemiAxisMajor

'*******************************************************

'''''''' G E S T I O N E E L L I S S I

'*******************************************************

For J = 0 To 720

Pnt(0) = (SemiAxisMajor * Cos(aini))

Pnt(1) = (SemiAxisMajor * Sin(aini)) * Rapp

Pnt(2) = 0.0

MyInd += 1

Vertex(MyInd) = Pnt(0)

MyInd += 1

Vertex(MyInd) = Pnt(1)

MyInd += 1

Vertex(MyInd) = Pnt(2)

aini += SinArc

Next J

LWpoly=THISDRAWING.MODESSPACE.ADDLWPOLYLINE .........

HMELLIARC=LWpoLY

END FUNCTION

"ljb" <.> ha scritto nel messaggio news:4865118@discussion.autodesk.com...
I need to convert an ellipse to a polyline in AutoCAD 2000 vba but an
ellipse can't be exploded. When AutoCAD 2000 saves the ellipse as an r12 DXF
it is converted to a 3d-polyline. How do I do the same?

Set sset = .SelectionSets.Add("ConvertEllipse")

grpCode(0) = 0: grpValue(0) = "ellipse"
sset.Select acSelectionSetAll, , , grpCode, grpValue
If sset.Count > 0 Then
For Each ssItem In sset

If ssItem.ObjectName = "AcDbEllipse" Then ????

Next
End If


thanks
LJB

Re: convert Ellipse to polyline

06-07-2005 12:35 AM in reply to: *ljb
It's correct.
But in this way you cannot decide the value of chord heigth tollerance .
With this programm i can draw an ellipse with an high number of vertex and
then with another programm i read the vertex and i can draw the ellipse with
arc.

Ciao

"Laurie Comerford" ha scritto nel
messaggio news:4867123@discussion.autodesk.com...
Hi,

Before proceeding further with your programming here, you may care to study
the "pellipse" system variable.


--

Regards,


Laurie Comerford
www.cadapps.com.au

"GPaolo" wrote in message
news:4865982@discussion.autodesk.com...
Try this.

I hope that this is tat you need.

Ciao

GPaolo





Function HMelliarc(ByVal SemiAxisMajor As Double, ByVal SemiAxisMinor As
Double)AS AcadLWPolyline

Dim LWpoly As AcadLWPolyline

Dim I As Integer

Dim J As Integer

Dim SinArc As Double

Dim aini As Double

Dim afin As Double

Dim Pnt(2) As Double

Dim Center(2) As Double

Dim Rapp As Double

Dim Vertex(2162) As Double

Dim MyInd As Long = -1

aini = 0.0

afin = TwoPI()

SinArc = afin / 720.0

Rapp = SemiAxisMinor / SemiAxisMajor

'*******************************************************

'''''''' G E S T I O N E E L L I S S I

'*******************************************************

For J = 0 To 720

Pnt(0) = (SemiAxisMajor * Cos(aini))

Pnt(1) = (SemiAxisMajor * Sin(aini)) * Rapp

Pnt(2) = 0.0

MyInd += 1

Vertex(MyInd) = Pnt(0)

MyInd += 1

Vertex(MyInd) = Pnt(1)

MyInd += 1

Vertex(MyInd) = Pnt(2)

aini += SinArc

Next J

LWpoly=THISDRAWING.MODESSPACE.ADDLWPOLYLINE .........

HMELLIARC=LWpoLY

END FUNCTION

"ljb" <.> ha scritto nel messaggio news:4865118@discussion.autodesk.com...
I need to convert an ellipse to a polyline in AutoCAD 2000 vba but an
ellipse can't be exploded. When AutoCAD 2000 saves the ellipse as an r12 DXF
it is converted to a 3d-polyline. How do I do the same?

Set sset = .SelectionSets.Add("ConvertEllipse")

grpCode(0) = 0: grpValue(0) = "ellipse"
sset.Select acSelectionSetAll, , , grpCode, grpValue
If sset.Count > 0 Then
For Each ssItem In sset

If ssItem.ObjectName = "AcDbEllipse" Then ????

Next
End If


thanks
LJB

Re: convert Ellipse to polyline

06-07-2005 05:19 AM in reply to: *ljb
I checked out the PELLIPSE system variable. Changing the value doesn't have
any affect on an ellipse already drawn. Changing the value only affects
those drawn after.

thanks
LJB
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!