Message 1 of 8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, I KNOW THIS IS FOR VBA FOR AUTOCAD BUT I NEED HELP.
I am using python and using both pyautocad and comtypes.client which is quite similar to VBA . I am trying to copy objects from specific layers from multiple autocad drawings to one autocad drawing (basically trying to combine them). But I am getting an error. This is my code:
# Copy model space of other drawings
for drawing in drawingslist[1:]:
drawing.Activate()
main_drawing = acad.ActiveDocument
print(drawing)
print(main_drawing)
#Select all entities in the drawing
source_model_space = main_drawing.ModelSpace
destination_model_space = destination_drawing.ModelSpace
objs = []
for obj in source_model_space:
if obj.Layer in target_layers:
objs.append(obj)
retObjects = main_drawing.CopyObjects(objs)
# Close the drawing
I am getting an error at retObjects = main_drawing.CopyObjects(objs) saying that the objs is a 'Invalid object array' for CopyObjects method.... How to fix??
Solved! Go to Solution.