I’m currently experiencing an issue which is hopefully due to my Python knowledge being pretty basic.
I have developed some Python code which creates corridors from alignments and profiles. This works as expected however, it does not apply the correct frequency and results in horizontal geometry points being skipped like the below image
To get around this issue I have been using BaselineRegion.AppliedAssemblySetting from the API Help and attempting to set the AppliedAtHorizontalGeometryPoints property of the AppliedAssemblySetting class (Help) and rebuild my corridor using my code below. However this seems to have no effect on the corridor and purely just rebuilds it without applying the AssemblySetting. I’m pretty sure the issue lies with the way I set the AppliedAssemblySetting.AppliedAtHorizontalGeometryPoints property but i’m not too sure.
def CreateCorridors(CorridorNames, AlignmentID, Assembly):
with adoc.LockDocument(): with adoc.Database as db: with db.TransactionManager.StartTransaction() as t: bt = t.GetObject(db.BlockTableId, OpenMode.ForWrite) btr = t.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) align = t.GetObject(AlignmentID, OpenMode.ForRead) profileID = align.GetProfileIds() NewCorridorID = 0 newcorr = 0 CivilDocument = CivilApplication.ActiveDocument NewCorridorID = CivilDocument.CorridorCollection.Add(CorridorNames, "Test", AlignmentID, profileID[0], "Test", Assembly,) newcorr = t.GetObject(NewCorridorID, OpenMode.ForWrite) class AppliedAssemblySetting: AppliedAtHorizontalGeometryPoints = True BLCollection = newcorr.Baselines regions = BLCollection[0].BaselineRegions settings = regions[0].AppliedAssemblySetting newcorr.Rebuild() t.Commit() pass return
Alternatively setting and applying the property using the following code would result in the error “AttributeError: static property ‘AppliedAtHorizontalGeometryPoints’ of ‘AppliedAssemblySetting’ can only be assigned to through a type, not an instance”
with adoc.LockDocument():
with adoc.Database as db:
with db.TransactionManager.StartTransaction() as t:
bt = t.GetObject(db.BlockTableId, OpenMode.ForWrite)
btr = t.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite)
align = t.GetObject(AlignmentID, OpenMode.ForRead)
profileID = align.GetProfileIds()
NewCorridorID = 0
newcorr = 0
CivilDocument = CivilApplication.ActiveDocument
NewCorridorID = CivilDocument.CorridorCollection.Add(CorridorNames, "Test", AlignmentID, profileID[0], "Test", Assembly,)
newcorr = t.GetObject(NewCorridorID, OpenMode.ForWrite)
AppliedAssemblySetting.AppliedAtHorizontalGeometryPoints = True
BLCollection = newcorr.Baselines
regions = BLCollection[0].BaselineRegions
settings = regions[0].AppliedAssemblySetting
newcorr.Rebuild()
t.Commit()
pass
return
I’m really stuck with this one and would very appreciate a helping hand !