Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Method 'SetVariable' of obj 'IAcadDoc...' failed

Status
Not open for further replies.

lrfcbabe

Programmer
Jul 19, 2001
108
US
After adding LayerObj to the code I began getting this error 4 the AcadDoc.SetVariable "pdmode", 34
Prior 2 adding the th above mentioned SetVariable worked fine. Any Ideas? Oh the LayerObj that I added works fine.

Private Sub Form_Load()
Top = (Screen.Height - Form1.Height) / 2
Left = (Screen.Width - Form1.Width) / 2
fraSelectFiles.Visible = True
cmdReselect.Enabled = False
lblETLabel.Visible = False
intFileSelected = 0
DoEvents
Call SetControls
Call AcadLink

Set AcadDoc = AcadApp.Documents(0)
startPoint(0) = 1#: startPoint(1) = 1#: startPoint(2) = 1#
endPoint(0) = 5#: endPoint(1) = 5#: endPoint(2) = 5#
Dbetweenpts startPoint, endPoint
Midpnt startPoint, endPoint
Set LineObj = AcadDoc.ModelSpace.AddLine(startPoint, endPoint)
Set LayerObj = AcadDoc.Layers.Add("SScrap")
LayerObj.Color = acBlue
AcadDoc.ActiveLayer = LayerObj
Set CircleObj = AcadDoc.ModelSpace.AddCircle(startPoint, Radpt)
Set ArcObj = AcadDoc.ModelSpace.AddArc(endPoint, Radpt, 1, 4)
AcadDoc.SetVariable "pdmode", 34
Set PointObj = AcadDoc.ModelSpace.AddPoint(MidPoint)
ZoomAll
End Sub
 
Hi irfcbabe,

I don't know if you've already done this but you'll have to declare a string variable for the system variable name:

ie:
Code:
Dim sysvar as String

..then set the variable:

Code:
sysvar = "pdmode"

..then continue your code..

Try it and see, It should remedy it..

Good Luck,

Renegade..
 
As posted it would work with one or the other, but not both.
So I moved it 2 here
Set AcadDoc = AcadApp.Documents(0)
AcadDoc.SetVariable "pdmode", 34
Seems 2 do the trick.
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top