svorgodne Posted February 16, 2014 Share Posted February 16, 2014 I need to switch to a specific OPENED drawing between 5. I know the name and the path It is already OPENED I HAVE USED THE VLA-ACTIVATE function but it opens a copy from the file adding a colon and a number at the end and as many times as I run the function it opens a new increesing the number after the colon. Is there a way to switch to a specific previous opened drawing in the current AutoCAD session and run a command there and come back to the file where it was invoked the function? Thanks in advance Quote Link to comment Share on other sites More sharing options...
Tharwat Posted February 16, 2014 Share Posted February 16, 2014 I use the keyboard buttons to step through drawings by pressing the tow buttons Ctrl + tab Quote Link to comment Share on other sites More sharing options...
svorgodne Posted February 16, 2014 Author Share Posted February 16, 2014 Yup. I thought I was considering all possibilities. I knew it was possible to do that. Still that doesn't solve my problem. I am looking for a specific routine that does what I explained because I want to make things automatically. Thanks anyhow Quote Link to comment Share on other sites More sharing options...
Tharwat Posted February 16, 2014 Share Posted February 16, 2014 Add the complete name of your opened drawing as shown in the code . (defun c:Test nil (vlax-for doc (vla-get-Documents (vlax-get-acad-object)) (if (eq (vla-get-fullname doc) [color=red]<complete_path_of_opened_drawing>[/color] ) (vla-put-windowstate doc acmax) (vla-put-windowstate doc acmin) ) ) (princ) ) (vl-load-com) Quote Link to comment Share on other sites More sharing options...
svorgodne Posted February 16, 2014 Author Share Posted February 16, 2014 Thanks a lot, pretty much what I was looking for .-) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted February 16, 2014 Share Posted February 16, 2014 Excellent . You're welcome . Quote Link to comment Share on other sites More sharing options...
Argo Posted November 2, 2015 Share Posted November 2, 2015 Hi, I've tried to use this code, It seems to minimise both windows without opening up the drawing. Any idea why it would do this. I'm using \\ in the filename Quote Link to comment Share on other sites More sharing options...
Tharwat Posted November 2, 2015 Share Posted November 2, 2015 Hi, I've tried to use this code, It seems to minimise both windows without opening up the drawing. Any idea why it would do this. I'm using \\ in the filename What does the function findfile return if you try it on filename? Quote Link to comment Share on other sites More sharing options...
Argo Posted November 2, 2015 Share Posted November 2, 2015 If I use that line in the cmdline i get (findfile "S:\\USER\\TEST.dwg") "S:\\USER\\TEST.dwg" which is the same as what I am typing in. Basically my code is (defun c:SwitchDWG nil (vlax-for doc (vla-get-Documents (vlax-get-acad-object)) (if (eq (vla-get-fullname doc) Default ) (vla-put-windowstate doc acmax) (vla-put-windowstate doc acmin) ) ) (princ) ) (vl-load-com) Where default gets switched out to the filepath S:\\USER\\TEST.dwg through a replace text vba code I have in excel. I have confirmed that the path exists in the file at the time of loading as I stepped through the vba code as it executed and noted that the path is there as autocad loads it. If it helps when i run the switchdwg list i get no errors or anything so it would seem something is working. Quote Link to comment Share on other sites More sharing options...
tombu Posted November 2, 2015 Share Posted November 2, 2015 Try: (defun SwitchDWG (drawing) (vlax-for doc (vla-get-Documents (vlax-get-acad-object)) (if (eq (vla-get-fullname doc) drawing ) (vla-put-windowstate doc acmax) (vla-put-windowstate doc acmin) ) ) (princ) ) (vl-load-com) and try (SwitchDWG "S:\\USER\\TEST.dwg") In a Ribbon Panel I have macros to open and activate a number of drawings and templates. Example: ^C^C^P(vla-activate(vla-open (vla-get-documents (vlax-get-acad-object))(findfile "chroma.dwg") :vlax-false)) I added the SwitchWindows Ribbon Menu Button to my Quick Access Toolbar which makes switching between open drawings as easy as it gets. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.