Hello everyone,
I am trying to create a Section in the 3D Modeling module with python and AutoCAD API, but when I instance the section, the script throws the following error:
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 44, in
TypeError: Cannot create instances of Section because it has no public constructorst
I share the script below and the information of the AutoCAD API that I am using, if anyone can help me, I will appreciate it.
Thank you
API information:
C#
public Section(Point3dCollection pts, Vector3d verticalDir);
# 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 *
# The inputs to this node will be stored as a list in the IN variables.
adoc = Application.DocumentManager.MdiActiveDocument
editor = adoc.Editor
with adoc.LockDocument():
with adoc.Database as db:
with db.TransactionManager.StartTransaction() as t:
#Open BlockTable for read
block_table = t.GetObject(db.BlockTableId,OpenMode.ForRead)
#Open BlockTable for write
block_table_recod = t.GetObject(block_table[BlockTableRecord.ModelSpace], OpenMode.ForWrite)
#Create a section Object
with Section(Point3d(5, 5, 0), Point3d(12, 3, 0), Vector3d(0, 0, 1)) as section_object:
block_table_recod.AppendEntity(section_object)
t.AddNewlyCreatedDBObject(section_object, True)
t.Commit()
pass
OUT = 0
Section.dyn (3.7 KB)