Small Fish Posted June 9, 2010 Share Posted June 9, 2010 Almost there with what I am trying to achieve. I would like to assign all layout tabs with the same pc3 picked by the user. How would that be done? Is there a function floating around that does that? thanks for any help! note: using a Dos_Lib function ;some parts by Lee Mac (defun C:SetPC3 (/ doc Pc3Files pc3) (vl-load-com) (vla-RefreshPlotDeviceInfo (vla-get-ActiveLayout (setq doc (vla-get-activedocument (vlax-get-acad-object))))) (setq Pc3Files (vl-remove-if-not (function (lambda (x) (wcmatch x "*.pc3"))) (vlax-invoke (vla-item (vla-get-layouts doc) "Model") 'GetPlotDeviceNames))) (setq pc3 (dos_listbox "Assign pc3 file to all tabs" "Select a pc3 file to assign to all tab layouts" Pc3Files "" )) (foreach x (vl-remove "Model" (layoutlist)) (putPc3 x Pc3Files);do I need a function - putPc3 ;or a few lines of extra code? );foreach );defun Quote Link to comment Share on other sites More sharing options...
alanjt Posted June 9, 2010 Share Posted June 9, 2010 (vlax-for x (vla-get-layouts doc) (or (eq (vla-get-name x) "Model") (vl-catch-all-apply (function vla-put-configname) (list x pc3)) ) ) However, your code could use a little house cleaning (since it will call the layouts multiple times, etc.). For the record (layoutlist) does not include "Model". Quote Link to comment Share on other sites More sharing options...
Small Fish Posted June 9, 2010 Author Share Posted June 9, 2010 thanks Alan but I am not sure whether I should make it a function or where to add it to my above code? and yes you are correct re: (layoutlist) does not include "Model". Quote Link to comment Share on other sites More sharing options...
alanjt Posted June 9, 2010 Share Posted June 9, 2010 thanks Alanbut I am not sure whether I should make it a function or where to add it to my above code? and yes you are correct re: (layoutlist) does not include "Model". Remove all that foreach crap at the bottom and add (if (setq pc3.....) add what I posted here ) (if (setq pc3 (dos_listbox "Assign pc3 file to all tabs" "Select a pc3 file to assign to all tab layouts" Pc3Files "" ) ) (vlax-for x (vla-get-layouts doc) (or (eq (vla-get-name x) "Model") (vl-catch-all-apply (function vla-put-configname) (list x pc3)) ) ) ) Quote Link to comment Share on other sites More sharing options...
Small Fish Posted June 9, 2010 Author Share Posted June 9, 2010 thanks Alan - but I can not get it to work with what you suggested Quote Link to comment Share on other sites More sharing options...
alanjt Posted June 9, 2010 Share Posted June 9, 2010 thanks Alan - but I can not get it to work with what you suggested ;some parts by Lee Mac (defun C:SetPC3 (/ doc Pc3Files pc3) (vl-load-com) (vla-RefreshPlotDeviceInfo (vla-get-ActiveLayout (setq doc (vla-get-activedocument (vlax-get-acad-object) ) ) ) ) (if (and (setq Pc3Files (vl-remove-if-not (function (lambda (x) (wcmatch x "*.pc3")) ) (vlax-invoke (vla-item (vla-get-layouts doc) "Model") 'GetPlotDeviceNames ) ) ) (setq pc3 (dos_listbox "Assign pc3 file to all tabs" "Select a pc3 file to assign to all tab layouts" Pc3Files "" ) ) ) (vlax-for x (vla-get-layouts doc) (or (eq (vla-get-name x) "Model") (vl-catch-all-apply (function vla-put-configname) (list x pc3)) ) ) ) (princ) ) ;defun Quote Link to comment Share on other sites More sharing options...
alanjt Posted June 9, 2010 Share Posted June 9, 2010 I'm not sure why you are refreshing the plotter devices to the active layout, but 'get'ing the plotter devices from model. What if you are not in model. Why not just take them from the active layout that you've already defined? Quote Link to comment Share on other sites More sharing options...
Small Fish Posted June 9, 2010 Author Share Posted June 9, 2010 Hey Alan that works brilliant - and I learned something new I suppose you meant : (vlax-for x (vla-get-layouts doc) should be: (vlax-for x (vla-get-layouts *AcadDoc ) just testing me I guess?:wink: cheers SF Quote Link to comment Share on other sites More sharing options...
alanjt Posted June 9, 2010 Share Posted June 9, 2010 Hey Alan that works brilliant - and I learned something new I suppose you meant : (vlax-for x (vla-get-layouts doc) should be: (vlax-for x (vla-get-layouts *AcadDoc ) just testing me I guess?:wink: cheers SF Huh? At the beginning of the routine, you defined the active document as doc.Am I missing something? Quote Link to comment Share on other sites More sharing options...
alanjt Posted June 9, 2010 Share Posted June 9, 2010 Keep in mind that, while you've successfully assigned a plotter to each layout, nothing else is set properly (sheet size, ctb, etc.). You should really look into using PageSetups. This will avoid a lot of legwork. 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.