Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to manipulate offset profile parameters. But nothing happens.
I can read offset profile parameters, but I can't write or remove.
I have Civil 3D 2022.1.1 Update.
I'm not sure I'm using it right, I don't know what I'm doing wrong, I'm trying 3 different ways. Why doesn't any of them work?
Here is my code snippet VB .NET:
Dim docCol As Autodesk.AutoCAD.ApplicationServices.DocumentCollection = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager
Dim db As Database = docCol.MdiActiveDocument.Database
Dim tr As Transaction = db.TransactionManager.StartTransaction()
Dim ln As Long
Dim lnProf As Long
Dim id As ObjectId
Dim idProf As ObjectId
ln = Convert.ToInt32(alignmentHANDLE, 16)
lnProf = Convert.ToInt32(profileHANDLE, 16)
Dim hn As New Handle(ln)
Dim hnProf As New Handle(lnProf)
id = db.GetObjectId(False, hn, 0)
Dim pl As Alignment = tr.GetObject(id, OpenMode.ForWrite) 'get offset alignmet
idProf = db.GetObjectId(False, hnProf, 0)
Dim plProf As Profile = tr.GetObject(idProf, OpenMode.ForWrite) 'get offset profile
Dim staDouble As Double
Dim slopeDouble As Double
staDouble = 600
slopeDouble = 0.05
Dim Prof_Parameters As New Profile.OffsetProfileParameters(plProf)
Dim Param_station As New Profile.OffsetProfileParametersStation(staDouble, slopeDouble, "test1")
'method 1
Prof_Parameters.Stations.Add(Param_station)
'method 2
Prof_Parameters.Stations.Insert(Prof_Parameters.Stations.Count, Param_station)
'method 3
staDouble = 700
slopeDouble = 0.05
Param_station.Station = staDouble
Param_station.Slope = slopeDouble
Param_station.Description = "test2"
plProf.OffsetParameters.Stations.Add(Param_station)
tr.Commit()
tr.Dispose()
Solved! Go to Solution.