Checking the civil 3d forum I saw this code and I would like to know how python can be edited according to lei is to be able to modify the radii of the alignment
Foro civil 3d
foreach (var entity in myALignment.Entities)
{
if (entity.EntityType == AlignmentEntityType.Arc)
{
var arc = (AlignmentArc)entity;
arc.Radius = 100;
}
else if (entity.EntityType == AlignmentEntityType.Spiral)
{
// cast and modify
}
}
probably this,
you may miss some import
for entity in myALignment.Entities:
if entity.EntityType == AlignmentEntityType.Arc:
arc = (AlignmentArc)entity
arc.Radius = 100
else:
if entity.EntityType == AlignmentEntityType.Spiral:
# cast and modify
else:
pass #or do something
I tried to apply it to the alignment but I don’t see that it modifies the radius
What would have to be changed to the code?
# Load the Python Standard and DesignScript Libraries
import sys
import clr
# Add Assemblies for AutoCAD and Civil3D
clr.AddReference('AcMgd')
clr.AddReference('AcCoreMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')
# Import references from AutoCAD
from Autodesk.AutoCAD.Runtime import *
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.EditorInput import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *
# Import references from Civil3D
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *
adoc = Application.DocumentManager.MdiActiveDocument
editor = adoc.Editor
for entity in myALignment.Entities:
if entity.EntityType == AlignmentEntityType.Arc:
arc = (AlignmentArc)entity
arc.Radius = 100
else:
if entity.EntityType == AlignmentEntityType.Spiral:
# cast and modify
else:
pass #or do something
OUT = 0