Hi all,
I am trying to create a ellipse using set method.
But i got 'eGeneralModelingFailure' exception when executing set method.
I can not find any related post about this.
Herewith i attached my code.
Please give a try!
Thanks & Regards,
G
Solved! Go to Solution.
Solved by Hallex. Go to Solution.
Try to rewrite the following Sub DrawEllipse on Function
This will draw an ellipse and ellipse arcs as well
<CommandMethod("elp")> _ Public Sub temp() Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database Dim acEditor As Editor = acDoc.Editor Using trans As Transaction = db.TransactionManager.StartTransaction() Dim btr As BlockTableRecord = CType(trans.GetObject(db.CurrentSpaceId, OpenMode.ForWrite), BlockTableRecord) DrawEllipse(btr, trans, New Point3d(0, 0, 0), 0.6, 20, 0.0, Math.PI * 2.0) trans.Commit() End Using End Sub Public Sub DrawEllipse(ByRef btr As BlockTableRecord, ByRef trans As Transaction, _ ByVal origPt As Point3d, ByVal radr As Double, _ ByVal leng As Double, ByVal sang As Double, ByVal eang As Double) Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument Dim db As Database = doc.Database Dim x As Vector3d = db.Ucsxdir Dim y As Vector3d = db.Ucsydir Dim normalVec As Vector3d = x.CrossProduct(y) Dim axisvec As Vector3d = normalVec.GetNormal() Dim elp As Ellipse = New Ellipse(origPt, _ axisvec, _ New Vector3d(0, leng / -2, 0.0), _ radr, _ sang, _ eang) btr.AppendEntity(elp) trans.AddNewlyCreatedDBObject(elp, True) End Sub
Hi,
Thank you very much for your help.
When i run your code with my own parameter values to draw ellipse, it returns exception of 'elockviolation'.
then, i add below lines
Using acLckDoc As DocumentLock = acDoc.LockDocument()
....'using transaction
....'end using
End using
It happens all of my code. I dont know where i am wrong?
I am always open blocktable record in openforwrite mode only. even though elockviolation error occurs .
Any idea?
Thanks & regards,
G