Hi, I’m trying to find the intersections my labels might have with another object. And for that I’m using the BoundingBoxIntersectWith() method, but I’m getting the following error: eInvalidExtents and I don’t understand what’s wrong and how to solve it.
Here is my python script:
# Load the Python Standard and DesignScript Libraries
import sys #sys is a fundamental Python library - here, we're using it to load in the standard IronPython libraries
import clr #This is .NET's Common Language Runtime. It's an execution environment that is able to execute code from several different languages.
# Add Assemblies for AutoCAD and Civil3D
clr.AddReference('AcMgd')
clr.AddReference('AcCoreMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')
clr.AddReference('ProtoGeometry') #A Dynamo library for its proxy geometry
#classes. You'll only need this if you're interacting with geometry
clr.AddReference('AeccPressurePipesMgd')
clr.AddReference('acdbmgdbrep')
clr.AddReference('Civil3DNodes')
clr.AddReference('AutoCADNodes')
import Autodesk #Loads the Autodesk namespace
# Import references from AutoCAD
AAR = Autodesk.AutoCAD.Runtime
AAA = Autodesk.AutoCAD.ApplicationServices #Setting a handle to the currently-open instance of the AutoCAD application
AAD = Autodesk.AutoCAD.DatabaseServices
AAE = Autodesk.AutoCAD.EditorInput
AAG = Autodesk.AutoCAD.Geometry
AADy = Autodesk.AutoCAD.DynamoNodes
AUX = Autodesk.Aec.DatabaseServices
OP = AAD.OpenMode
TS = AAD.Transaction
# Import references from Civil3D
ACA = Autodesk.Civil.ApplicationServices #Setting a handle to the currently-open instance of the Civil3D application
ACD = Autodesk.Civil.DatabaseServices
ACDy = Autodesk.Civil.DynamoNodes
AD = ACA.CivilApplication.ActiveDocument #Finally, setting up handles to the active Civil3D document
AC = Autodesk.Civil
adoc = AAA.Application.DocumentManager.MdiActiveDocument
editor = adoc.Editor
#Inputs:
#IN[0] -> List of List of Civil Object
with adoc.LockDocument():
with adoc.Database as db:
with db.TransactionManager.StartTransaction() as t:
# E vem ai:
Ratio = 0.5
Labels = []
for i in range(0,len(IN[0])):
for j in range(0,len(IN[0][i])):
Point = IN[0][i][j].InternalDBObject.Position
PT = AAG.Point3d(Point.X+6, Point.Y-5, Point.Z)
Labels.append(ACD.StructureLabel.Create(IN[0][i][j].InternalDBObject.Id,IN[1],PT))
LabelsEx = TS.GetObject(t,Labels[0],OP.ForRead)
PColle = AAG.Point3dCollection()
OBO = AAD.Intersect.OnBothOperands
LabelsEx.BoundingBoxIntersectWith(IN[0][0][0].InternalDBObject,OBO,PColle,0,0)
t.Commit()
# Assign your output to the OUT variable.
OUT = LabelsEx