Author Topic: Search a plotstyle ...  (Read 4059 times)

0 Members and 1 Guest are viewing this topic.

Hangman

  • Swamp Rat
  • Posts: 566
Search a plotstyle ...
« on: November 14, 2012, 01:49:55 PM »
Afternoon everyone,

I am importing a plotstyle into a drawing and want to search for the plotstyle.  If it exists in the drawing, don't import.
But you can't (at least I can't find how to) use "tblsearch" to look for it.

How would you search for a plot style?

Thanks.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Search a plotstyle ...
« Reply #1 on: November 14, 2012, 02:02:53 PM »
Are you referring to the CTB file in the page setup?
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

Hangman

  • Swamp Rat
  • Posts: 566
Re: Search a plotstyle ...
« Reply #2 on: November 14, 2012, 02:11:26 PM »
Are you referring to the CTB file in the page setup?

No, actually the Page Setup itself.
For example, we have 5 plotters in the office, but the drawing template only has 3 of the 5.
I'm new here and can't modify the template (they don't let newbies modify anything).  So, When I start a new drawing, I have to manually create a page setup for the 4th and 5th plotter.
So I created my own template and simply import the page setup into the new drawing.  But sometimes I forget I already did this and when I run my import lisp again, it gives me the notice that the page setup already exists, do I want to overwrite it?  So I want to search for the page setup and verify it's in the drawing before the import kicks in.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Search a plotstyle ...
« Reply #3 on: November 14, 2012, 02:55:51 PM »
Code: [Select]
; (getPlotConfigNames (vla-get-activedocument (vlax-get-acad-object)))
(defun getPlotConfigNames (document / names)
 (reverse
  (vlax-for x (vla-get-plotconfigurations document)
   (setq names (cons (vla-get-name x) names))
   )
  )
 )
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

danallen

  • Guest
Re: Search a plotstyle ...
« Reply #4 on: November 14, 2012, 02:57:40 PM »
here is what I use

-Dan

Code: [Select]

(setq ACME_PAGESETUPS  "u:\\Drawings\\_Support\\Cad Standards\\SDG-Settings.dwg")

;;;============================================================================
;;; Delete Page Setups
;;; From: "Ken Alexander" <kalex@fremontmillwork.com
;;;============================================================================
(defun-q ACME_DeletePlotConfig (pcname / plcfg)
  (setq plcfg (vl-catch-all-apply
                'vla-item
                (list (vla-get-plotconfigurations (vla-get-activedocument (vlax-get-acad-object)))
                      pcname
                ) ;_ list
              ) ;_ vl-catch-all-apply
  ) ;_ setq
  (if (not (vl-catch-all-error-p plcfg))
    (vla-delete plcfg)
  ) ;_ if
) ;_ defun


;;;============================================================================
;;; CONFIGURE PAGE SETUPS
;;;============================================================================
  (defun-q ACME_pageSetupMsg ( size / )
    (if dos_msgbox
      (dos_msgbox
        (strcat "Reloaded " size " pagesetups from ACME Settings.dwg"
           "\n\nTo refresh display go to PageSetups and Double-click desired setup"
        )
        "Pagesetups"
        1 ; OK button
        3 ; info icon
        3 ; 3 sec duration
      )
      (alert (strcat "Reloaded " size " pagesetups from ACME Settings.dwg"
        "\n\nTo refresh display go to PageSetups and Double-click desired setup"))
    )
  )

(defun-q c:PG24x36 ( / psn)
    (setq psn "Olive_24x36_Half")
    (ACME_DeletePlotConfig psn) ;delete page setup if it exists
    (command "-psetupin" ACME_PAGESETUPS psn)
    (setq psn "Olive_24x36_Full")
    (ACME_DeletePlotConfig psn) ;delete page setup if it exists
    (command "-psetupin" ACME_PAGESETUPS psn)
    (ACME_pageSetupMsg "24x36")
    (princ)
  )

Hangman

  • Swamp Rat
  • Posts: 566
Re: Search a plotstyle ...
« Reply #5 on: November 14, 2012, 03:03:48 PM »
Hello Charles, it's been a while.  Good to hear from you.  And thank you for the help.

And thank you Dan for the help as well.

I will make the best of these and get back when I can.

Thank you again guys.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Search a plotstyle ...
« Reply #6 on: November 14, 2012, 05:22:25 PM »
I just delete all the page setups then re-import all of them. This way you don't get any prompts.

Something like this:

Code: [Select]
(defun c:page (/ psetups)
  (vl-load-com)
  (vlax-map-collection
    (vla-get-plotconfigurations (vla-get-activedocument (vlax-get-acad-object)))
    'vla-delete
  )
  ;; Modify this line
  (setq psetups "S:/Your/Filepath/GoesHere/sht_manager_overrides.dwt")
  (if (findfile psetups)
    (progn (setvar 'filedia 0)
   (vl-cmdf ".-psetupin" psetups "*")
   (setvar 'filedia 1)
   (princ "\n <<<Pagesetups Imported>>>")
    )
    (princ "\n <<<Pagesetups NOT FOUND!>>>")
  )
  (princ)
)
« Last Edit: November 14, 2012, 05:26:11 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Cathy

  • Guest
Re: Search a plotstyle ...
« Reply #7 on: November 14, 2012, 05:53:18 PM »
Are you referring to the CTB file in the page setup?

No, actually the Page Setup itself.
For example, we have 5 plotters in the office, but the drawing template only has 3 of the 5.
I'm new here and can't modify the template (they don't let newbies modify anything).  So, When I start a new drawing, I have to manually create a page setup for the 4th and 5th plotter.
So I created my own template and simply import the page setup into the new drawing.  But sometimes I forget I already did this and when I run my import lisp again, it gives me the notice that the page setup already exists, do I want to overwrite it?  So I want to search for the page setup and verify it's in the drawing before the import kicks in.

I can understand not wanting everyone to be able to change the template, but surely someone has write access to the template and can add the new plotters to it!  Seems infinitely easier than copying and recopying page setups a zillion times.  :?

Hangman

  • Swamp Rat
  • Posts: 566
Re: Search a plotstyle ...
« Reply #8 on: November 14, 2012, 06:49:42 PM »
I just delete all the page setups then re-import all of them. This way you don't get any prompts.
  < ... >

Ron,
If you are just deleting them all, why not use the 'expert' set to 5 and then your code is only a fraction of the size and you accomplish the same goal?

Jus' wonder'n



I can understand not wanting everyone to be able to change the template, but surely someone has write access to the template and can add the new plotters to it!  Seems infinitely easier than copying and recopying page setups a zillion times.  :?

Cathy,
Yes I agree also.  I've been around enough to see newbies screw things up to the point the company is on the brink of disaster.  But it's also a difficult to ask a somebody who has access and have been with the company for years to update this simple thing when they say something to the effect of:
Quote
That is a low priority on the list at the moment and I don't have time nor the will to do it.  When you can get an executive order from the president and I don't have anything else worthwhile to do, then I'll think about it.
  Sounds alot like the IT guy.   :laugh:
Of course, as I'm walking away I hear them cursing under their breath,
Quote
Stupid newbies don't know anything.
   :oops:

Anyway, for the moment and probably the next 5 years, I have to work around it all.  But who knows, perhaps by then I'll be laid-off again and back where I was when I found this job.   :wink:
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Lee Mac

  • Seagull
  • Posts: 12924
  • London, England
Re: Search a plotstyle ...
« Reply #9 on: November 14, 2012, 07:58:42 PM »
But you can't (at least I can't find how to) use "tblsearch" to look for it.

dictsearch  :-)

Code - Auto/Visual Lisp: [Select]
  1. (defun _configsearch ( config )
  2.     (dictsearch (cdr (assoc -1 (dictsearch (namedobjdict) "ACAD_PLOTSETTINGS"))) config)
  3. )

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Search a plotstyle ...
« Reply #10 on: November 14, 2012, 08:01:50 PM »
I just delete all the page setups then re-import all of them. This way you don't get any prompts.
  < ... >

Ron,
If you are just deleting them all, why not use the 'expert' set to 5 and then your code is only a fraction of the size and you accomplish the same goal?

Jus' wonder'n

...

True .. that will suppress the prompts but it won't remove old setups.  :-P

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Search a plotstyle ...
« Reply #11 on: November 19, 2012, 08:07:33 AM »
Just curious. If you're going to delete setups before importing them, what happens to layouts which have been assigned to a setup? Wouldn't the expert=5 or even a while-CmdActive idea work "better" in this scenario? Or do you want to dis-assign all plot setups from tabs?
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Search a plotstyle ...
« Reply #12 on: November 19, 2012, 10:34:07 AM »
If the resources (CTB pc3 etc.) for the page setup are still available, the setup that was saved to a layout will remain intact minus the name (will show "<None>").

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Search a plotstyle ...
« Reply #13 on: November 20, 2012, 02:55:51 AM »
What I'm concerned with though: Generally if I load setups (and especially if I'm overwriting existing ones), I'd like the layouts to update accordingly. If I first delete the config from the drawing, then the layout is disassociated from it and reloading does not re-associate the layout. Which means I'll have to re-run my code from here: http://forums.augi.com/showthread.php?80461-Page-Setup-Manager
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Search a plotstyle ...
« Reply #14 on: November 20, 2012, 10:23:39 AM »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.