• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

dwg file opening from command button

  • Thread starter Thread starter libra86
  • Start date Start date

libra86

Guest
Good morning to all,

as from title I would like to open a certain dwg file from a specially created command button.
in an old discussion I found this instruction to insert in the macro of the button:

(setq acapp (vlax-get-acad-object))
(seq acdocs (vla-get-documents acapp))
(vla-open acdocs d:/drawings/mydrawing.dwg)
(vla-activate (vla-item acdocs) (- (vla-get-count acdocs) 1))

the instruction works however I don't understand why before opening the file, it opens twice the user interface customization window (like by _.quickcui), or it opens twice the "guide" window (that of the f1 key to understand us).
only after manually closing the above windows opens the file.

Can you tell me how to remove the opening of these windows?
or do you have other methods to open a dwg by button?

Thank you in advance!
 
no, cè il problema sdi, prova così:

^c^c(vla-activate (vla-open (vla-get-documents (vlax-get-acad-object) "d:/ladri/juve.dwg"))
:tongue:
 
Okay, thank you, I try and let you know!

p.s. the folder "ladri/juve.dwg" is fantastic:wink:
 
It seems to work! Thank you so much!
Would it work if the file is on a network server?
 
open a dwg from the server, take note of the path in the title bar (replace \ with / ) and return it to the example code above.
 
return to the discussion to ask for a suggestion:
if after opening the file that interests me with the macro ^c^c(vla-activate (vla-open (vla-get-documents (vlax-get-acad-object))) "c:/????????????dwg")) you want to automatically execute a command (type the command "line") what should I add?
I tried to insert _line at the end of the macro but it does not work.... .
 
mmm... I would opt for a scribe, like:
_open
"d:/ladri/juve.dwg"
_line
0.0
3.3
to launch the script the macro for the menu button could be:
^c^cscript "d:/pippo.scr"
 
Thank you very much, you are always number 1! :finger:
the script works perfectly, but I have problems with the menu button; If I write the macro as you told me, it does not run the script but always asks to "type script file name"......

update:
I solved in the sense that your macro was right but as the file to open was on server I used in the address the bar \ .
for test I moved the file on pc and putting address with bars / it has worked!
So now the question is: if the script is on server, how do I write the macro?
 
Thank you very much, you are always number 1! :finger:
the script works perfectly, but I have problems with the menu button; If I write the macro as you told me, it does not run the script but always asks to "type script file name"......

update:
I solved in the sense that your macro was right but as the file to open was on server I used in the address the bar \ .
for test I moved the file on pc and putting address with bars / it has worked!
So now the question is: if the script is on server, how do I write the macro?
solved:
also for addresses needs to be used the bar /

Thank you all.
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top