-
Solved: attatch xref
Ok, you knew i would be back...
well apparently my first routine has got a glitch, so im not done yet...
the problem lies with this statement:
ThisDrawing.PaperSpace.AttachExternalReference(XRpath, "XR-Title", ("0,0,0"), 1, 1, 1, 0, False)
where XRpath = "U:\pathname\drawingname.dwg"
ive tried many variations of parens and quotes none of which work...
anyhelp?
ccastelein
-
has my post really stumped people? im at a total loss as to why
the statement wont work...
i was hoping at least someone could point me in the right direction as to
why it wont work rather than solve it for me... the error messages are
quite vague..
ccastelein
-
Ok this is a little closer (i think)
i get an error (5) invalid procedure or argument error message with the following:
Set newXR = ThisDrawing.PaperSpace.AttachExternalReference(XRpath, "XR-Title", "0,0,0", 1, 1, 1, 0, False)
where XRpath = "U:\pathname\drawingname.dwg" and
newXR As AcadExternalReference
am i passing the "0,0,0" wrong or isnt the "attachExternalReference" supported in acad?
ccastelein
-
Hi ccastelein,
the 0,0,0 is wrong. You have to remember that Acad like arrays, so to fix the problem setup a zero based array with 0's in them. For this a "short cut" would be:
Dim InsrtPts(0 to 2) as double
Set newXR = ThisDrawing.PaperSpace.AttachExternalReference(XRpath, "XR-Title", InsrtPts,1, 1, 1, 0, False)
This is kinda taking advantage of VBA because when the variable is dimensioned the default values are 0's
Tommy
-
ok, i have tried your suggestion before as it was given as an example in my vba manual...im getting this:
Invalid procedure call or argument (Error 5)
either "An argument probably exceeds the range of permitted values"
or
"if an attempt is made to call a procedure that isn't valid on the current platform"
thats why i was wondering if it wasnt supported...cant beleive ADT6 wouldnt.
ccastelein
-
ok, i think its solved.
i had put the variable InsrtPts in the PUBLIC and no go.
then i put the Dim statement in the module and no go.
then i decided i would try and put the Dim statement right before
the Set newXR statement in the form and Voila it worked....
now why wouldnt the variable be defined if i put it in the Public statement like all the others? strange.
but putting it right before calling it worked..
thanks tommy
ccastelein
-
The only thing I can say is this worked for me in Acad 2000i
[VBA]
'for paper space
Sub AA()
Dim newXR As AcadExternalReference
XRpath = "c:\acad\abtit.dwg"
Dim InsrtPts(0 To 2) As Double
Set newXR = ThisDrawing.PaperSpace.AttachExternalReference(XRpath, "XR-Title", InsrtPts, 1, 1, 1, 0, False)
End Sub
'and for model space
Sub AA()
Dim newXR As AcadExternalReference
XRpath = "c:\acad\abtit.dwg"
Dim InsrtPts(0 To 2) As Double
InsrtPts(0) = 15
Set newXR = ThisDrawing.ModelSpace.AttachExternalReference(XRpath, "XR-Title", InsrtPts, 1, 1, 1, 0, False)
End Sub
[/VBA]
-
-
Hi,
I am completely new to AutoCAD 2002 and the various API available for coding with VB, can u help me how do i go about and also it would be great if there is any documentation which explains about various methods available and their purpose.
Thanks in advance.
Deepti
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules