Message 1 of 10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hello everyone
I want to check if this only happens on my computer
First of all, if you delete the profile view from the attached drawing, return it to ctrl+Z, and then create a profile view made with .net api, you will find that the created profileview is not deleted.
When tested on Civil 3D 2021, Civil 3D 2022, it worked well, but it did not work on Civil 3D 2023.2.1
Below is my code to create the profile view
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Geometry;
using Autodesk.Civil.ApplicationServices;
using Autodesk.Civil.DatabaseServices;
namespace TestCreateProfileView
{
public class Class1
{
[CommandMethod("CreateProfileView")]
public void CreateProfileView()
{
CivilDocument cdoc = Autodesk.Civil.ApplicationServices.CivilApplication.ActiveDocument;
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
PromptEntityOptions pEntOpt = new PromptEntityOptions("Select Alignment");
pEntOpt.SetRejectMessage("Not Alignment");
pEntOpt.AddAllowedClass(typeof(Alignment), true);
PromptEntityResult pEntRes = ed.GetEntity(pEntOpt);
if (pEntRes.Status != PromptStatus.OK)
return;
ObjectId alignId = pEntRes.ObjectId;
try
{
using (doc.LockDocument())
{
using (Transaction tr = db.TransactionManager.StartTransaction())
{
Alignment align = tr.GetObject(alignId, OpenMode.ForWrite) as Alignment;
ProfileView.Create(alignId, new Point3d(0, 0, 0));
tr.Commit();
}
}
}
catch
{
}
}
}
}Thanks for reading my long question.
Solved! Go to Solution.