Hello,
I am in Excel 2010 VBA editor and I am trying to run the routine shown below.
For some reason these two lines don't work.
Dim mylineobject As AcadLine
Dim CircleObj As AcadCircle
Any ideas?
Thanks
Kato01
Public Sub test()
'=======================================
A$ = "########0.0"
On Error Resume Next
Set acadApp = GetObject(, "AutoCAD.Application")
If Err Then
Err.Clear
Set acadApp = CreateObject("AutoCAD.Application")
If Err Then
MsgBox Err.Description
Exit Sub
End If
End If
acadApp.Visible = True ' AUTOCAD
acadApp.Top = 0
acadApp.Left = 0
acadApp.Width = 1024
acadApp.Height = 740
Set ObjAcad = GetObject(, "Autocad.Application")
ObjAcad.Visible = True
Set AcadDoc = acadApp.ActiveDocument
Set AcadUtil = AcadDoc.Utility
activeDoc.ActiveSpace = acModelSpace
'=================================================
Dim mylineobject As AcadLine '<============== problem 1
Dim CircleObj As AcadCircle '<============== problem 2
Dim startpoint(0 To 2) As Double
Dim endpoint(0 To 2) As Double
Dim CircleCenter(0 To 2) As Double
'FIRST LINE
startpoint(0) = 0
startpoint(1) = 0
startpoint(2) = 0
endpoint(0) = 1
endpoint(1) = 0
endpoint(2) = 0
'SECOND LINE
startpoint(0) = 0.5
startpoint(1) = -0.5
startpoint(2) = 0
endpoint(0) = 1
endpoint(1) = 0
endpoint(2) = 0
Set mylineobject = ThisDrawing.ModelSpace.AddLine(startpoint, endpoint)
'=========
CircleCenter(0) = 1.2: CircleCenter(1) = 22: CircleCenter(2) = 0
Set CircleObj = ThisDrawing.ModelSpace.AddCircle(CircleCenter, 15)
CircleObj.Color = acGreen
ZoomExtents
Set ACAD = Nothing
End Sub
Hi katto01
Please wrap your code in code tags, before the moderators (come back and) get you...
Click here - Forum rules
Cheers3. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # button at the top of the post window. If you are editing an existing post, press Go Advanced to see the # button.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks