Author Topic: load certain files in startup suite based on profile  (Read 6192 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
Re: load certain files in startup suite based on profile
« Reply #15 on: January 10, 2008, 05:13:28 PM »
Ron,

If you mean this one I changed the profile names back to match those in the code then put this in our acad.lsp and when I open acad it shows some page setups but I don't think it deletes the ones that already exist in our template because when i switch to the other profile and restart autocad the pagesetups are not different. All I have in acad.lsp is this:

Code: [Select]
(defun loadfromdwt (/ pro pc)
  (setq pro (getvar 'cprofile)
pc  (vla-get-Plotconfigurations
      (vla-get-ActiveDocument
(vlax-get-Acad-Object)
      )
    )
  )
  (cond ((= pro "Mechoshade Standard")
(vlax-map-collection pc 'vla-delete)
(command ".-psetupin" "PAGE-SETUPS.DWT" "*")
)
((= pro "Mechoshade Standard PM")
(vlax-map-collection pc 'vla-delete)
(command ".-psetupin" "PAGE-SETUPS PM.DWT" "*")
)
  )
  (princ)
)

ronjonp

  • Needs a day job
  • Posts: 7529
Re: load certain files in startup suite based on profile
« Reply #16 on: January 10, 2008, 05:28:46 PM »
Are you calling it by using (loadfromdwt)?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

ELOQUINTET

  • Guest
Re: load certain files in startup suite based on profile
« Reply #17 on: January 10, 2008, 05:43:38 PM »
i'm just putting it in my acad.lsp but not running it. so should i rather save this out as a seperate lisp then run it from acad.lsp. I'm not sure I understand you're question I guess?

ronjonp

  • Needs a day job
  • Posts: 7529
Re: load certain files in startup suite based on profile
« Reply #18 on: January 10, 2008, 05:48:02 PM »
You need to run it, all you are doing is loading it....

(defun loadfromdwt (/ pro pc)
  (setq   pro (getvar 'cprofile)
   pc  (vla-get-Plotconfigurations
         (vla-get-ActiveDocument
      (vlax-get-Acad-Object)
         )
       )
  )
  (cond   ((= pro "Mechoshade Standard")
   (vlax-map-collection pc 'vla-delete)
   (command ".-psetupin" "PAGE-SETUPS.DWT" "*")
   )
   ((= pro "Mechoshade Standard PM")
   (vlax-map-collection pc 'vla-delete)
   (command ".-psetupin" "PAGE-SETUPS PM.DWT" "*")
   )
  )
  (princ)
)
(loadfromdwt);;this is what runs the routine

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

ELOQUINTET

  • Guest
Re: load certain files in startup suite based on profile
« Reply #19 on: January 11, 2008, 09:18:08 AM »
ah i see now i got it it works great. i added it to our acad.lsp and it's super. i will be testing this further today but for now it looks like exactly what i needed. thanks for your help

ronjonp

  • Needs a day job
  • Posts: 7529
Re: load certain files in startup suite based on profile
« Reply #20 on: January 11, 2008, 09:27:59 AM »
Glad to help :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

ELOQUINTET

  • Guest
Re: load certain files in startup suite based on profile
« Reply #21 on: January 16, 2008, 04:25:03 PM »
Ron or anyone else who might have some insight. I added this code to our acad.lsp and are having some problems when publishing. Let me explain, We do not and cannot have a pagesetup for every possible printing scenario for instance we get architectural files in so many forms that we often have to create a page setup for this using window, save the page setup, then open publish and apply this page setup to any added layouts. It is stopping after the first layout publishes. What I need to figure out is how to specify a list of layouts to delete using the vla-delete part and retain whatever page setups were created for that file. In other words I want it to delete only the page setups, which ever ones are present which would need to be redefined when they are imported from the dwt(s). Am I making sense?

ronjonp

  • Needs a day job
  • Posts: 7529
Re: load certain files in startup suite based on profile
« Reply #22 on: January 16, 2008, 04:48:09 PM »
Dan,

You could use something like this to remove only the pagesetups in the list of names:

Code: [Select]
(vlax-map-collection
  pc
  '(lambda (x)
     (if (member
   (vla-get-name x)
   '("nameofpagesetup1" "nameofpagesetup2" "nameofpagesetup2");;names here...case sensitive
)
       (vla-delete x)
     )
   )
)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

ELOQUINTET

  • Guest
Re: load certain files in startup suite based on profile
« Reply #23 on: January 16, 2008, 05:29:56 PM »
ron when i load it now i am getting this message, what's going on?

error: misplaced dot on input

Code: [Select]
;;This loads the page setups from either page setups.dwt or setups pm.dwt depending on which profile is loaded
(defun loadfromdwt (/ pro pc)
  (setq   pro (getvar 'cprofile)
   pc  (vla-get-Plotconfigurations
         (vla-get-ActiveDocument
      (vlax-get-Acad-Object)
         )
       )
  )
  (cond   ((= pro "Mechoshade Standard")
(vlax-map-collection
  pc
  '(lambda (x)
     (if (member
   (vla-get-name x)
   '("A1-FX" "A1-PDF 5D" "A1-PDF Bluebeam" "A1-PROT" "d-prot-500ps" "d-prot-800" D-Prot PDF Bluebeam" "D-Prot Xerox510" "DETAILS 11 X 17" "DETAILS 11 X 17 PDF 5D" "DETAILS 11 X 17 PDF Bluebeam" "HP LASER 11x17" "LANDSCAPE" "LANDSCAPE-PDF" "LEGAL" "LEGAL-FAX" "LEGAL-PDF" "small_copy")
)
       (vla-delete x)
     )
   )
)
   (command ".-psetupin" "PAGE-SETUPS.DWT" "*")
   )
   ((= pro "Mechoshade Standard PM")
   (vlax-map-collection pc 'vla-delete)
   (command ".-psetupin" "PAGE-SETUPS PM.DWT" "*")
   )
  )
  (princ)
)
(loadfromdwt);;this is what runs the routine

ronjonp

  • Needs a day job
  • Posts: 7529
Re: load certain files in startup suite based on profile
« Reply #24 on: January 16, 2008, 05:32:35 PM »
D-Prot PDF Bluebeam" is missing a quote.

On a side note....are you familiar with the VLIDE editor? If you put your code in there to analyze it, the color coding and auto formatting would really help you with some of this small troubleshooting. (VLIDE on the command line...NEW...then paste in your code).



« Last Edit: January 16, 2008, 05:37:32 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: load certain files in startup suite based on profile
« Reply #25 on: January 16, 2008, 05:37:57 PM »
D-Prot PDF Bluebeam" is missing a quote.

Eloquintet 
 
If you were to use the VLIDE in AutoCAD to view the code you'd notice this mismatch immediately.


Oooops , Ron updated his post to show the same thing :-)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

ELOQUINTET

  • Guest
Re: load certain files in startup suite based on profile
« Reply #26 on: January 17, 2008, 10:30:35 AM »
Sorry guys I should've done that but my mind is not functioning on all cylinders right now. I am about to leave my job and am trying to fix a bunch of things and whatnot. my apologies