AutoCAD Civil 3D Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Create Alignment offset
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi,
I am creating an alignment offset for all alignments in my drawing (See the code below), however i am getting this warning message
" Warning 1 'Public Function CreateOffsetAlignment(offsetDistance As Double) As Autodesk.AutoCAD.DatabaseServices.ObjectId' is obsolete: 'Use static method Autodesk.Civil.Land.DatabaseServices.Alignment.Cre
Here is the code
PublicSubT10()
' This Program is to create alignment offset
Dim mydoc AsDocument = Application.DocumentManager.MdiActiveDocument
Dim mytrans AsTransaction= mydoc.TransactionManager.StartTransaction
Dim mycivil AsCivilDocument = Autodesk.Civil.ApplicationServices.CivilApplication.ActiveDocument
Dim ed AsEditor = Application.DocumentManager.MdiActiveDocument.Editor()
Dim alignments AsObjectIdCollection= mycivil.GetAlignmentIds
Dim i AsInteger= 0
Dim x AsDouble = InputBox("Please Enter alignment offset value")
Try
For i = 0 Toalignments.Count - 1
Dim a1 AsAlignment = mytrans.GetObject(alignments(i), OpenMode.ForRead)
Dim a2 AsObjectId= a1.CreateOffsetAlignment(10)
Next
Catch ex AsSystemException
MsgBox(ex.Message)
If mytrans IsNotNothingThenmytrans.Abort()
Finally
MsgBox("This is done By Tamer Mourad")
If mytrans IsNotNothingThenmytrans.Dispose()
EndTry
EndSub
Regards,
Tamer Mourad
Solved! Go to Solution.
Re: Create Alignment offset
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi,
>> warning message
I have not looked behind the warning, it means that the method/function may not be supported in one of the next releases of the API. So it should run normal without any errors at the moment.
I don't see what you "imported" and so in what Namespace you are using currently the .CreateOffsetAlignment. You can check that by yourselves ==> right click on this function ==> objectbrowser
>> and there is no output when i run the program
I'm missing the .Commit for the transaction, so nothing will be written back to the database.
- alfred -
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Re: Create Alignment offset
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks it worked
i missed the commit
