TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: jitupnair on September 20, 2011, 04:11:21 AM

Title: Help me to find the Error
Post by: jitupnair on September 20, 2011, 04:11:21 AM
Hi All,
I am trying to attach one file to all drawing files in a selected directory (Batch xref attach). I need to attach the file in model space. But this lisp is attaching the file in the last saved space in my system.
I am using AutoCAD 2010.

Please help me to find the error in the attached file
Title: Re: Help me to find the Error
Post by: jitupnair on October 05, 2011, 01:49:40 AM
Help me please ........................ :oops:
Title: Re: Help me to find the Error
Post by: irneb on October 05, 2011, 03:08:30 AM
Sorry I'm unsure why this happens. You are using the AttachExternalReference method on the ModelSpace object, so it "should" get attached correctly. Perhaps it's a bug with DBX?

Perhaps rather use a script and set the CTab of these drawings to "Model" before you run your code.

Alternatively you could do so through the ActiveX just before attaching:
Code: [Select]
(vla-put-ActiveLayout doc (vla-Item (vla-get-Layouts doc) "Model"))Perhaps that would help.
Title: Re: Help me to find the Error
Post by: jitupnair on October 05, 2011, 06:14:05 AM
; error: ActiveX Server returned the error: unknown name: ActiveLayout
Title: Re: Help me to find the Error
Post by: jitupnair on October 05, 2011, 06:16:04 AM
Thanks for your replay

When I used (vla-put-ActiveLayout doc (vla-Item (vla-get-Layouts doc) "Model"))
Its giving an error as shown below.
; error: ActiveX Server returned the error: unknown name: ActiveLayout
Title: Re: Help me to find the Error
Post by: irneb on October 05, 2011, 06:26:25 AM
I'm not sure why. It seems to work fine on my Vanilla 2011, though I haven't tested it through DBX - which may be the problem. There's many strange things which isn't perfect inside DBX.

AFAICT your best bet would be to go with SCR and just change the CTab variable to Model. But then it's probably just as good to include the XAttach through the SCR as well.