Code: Select all
import win32com.client
# Create an instance of IntelliCAD
icad = win32com.client.Dispatch("Icad.Application")
# Make the IntelliCAD application visible
icad.Visible = True
# Get the current document
doc = icad.ActiveDocument
print(doc.Name)
# Create a new layer
doc.Layers.Add('New Layer')
# Create points
p1 = icad.Library.CreatePoint(0, 0)
p2 = icad.Library.CreatePoint(10, 10)
p3 = icad.Library.CreatePoint(10, 0)
# Draw line
line = doc.ModelSpace.AddLine(p1, p2)
# Draw Text
text = doc.ModelSpace.AddText('Hello World', p1, 1)
# Draw Polyline
pline = doc.ModelSpace.AddPolyLine([p1, p2, p3])