Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a polyline that delimits an area, within this area I have several blocks, in the documentation I could not understand the procedure, below is my coding that is giving an exception.
Documentation: SelectByPolygon Method (ActiveX)
https://help.autodesk.com/view/ACD/2017/ESP/?guid=GUID-D8002585-5D08-45E2-AF6C-6E894FA3D463
import win32com.client as wc
import pythoncom as p
acad = wc.Dispatch("AutoCAD.Application")
acadDoc = acad.ActiveDocument
acadModel = acad.ActiveDocument.ModelSpace
def APoint(x, y, z = 0):
return wc.VARIANT(p.VT_ARRAY | p.VT_R8, (x, y, z))
def ADouble(xyz):
return wc.VARIANT(p.VT_ARRAY | p.VT_R8, xyz)
def ADispatch(vObject):
return wc.VARIANT(p.VT_ARRAY | p.VT_R8, vObject)
ponto = []
for entity in acadModel:
name = entity.EntityName
if name == 'AcDbPolyline':
ponto.append(entity.Coordinates)
#ERROR EXCEPTION
acadModel.SelectByPolygon(ponto[0])
Solved! Go to Solution.