Visual LISP, AutoLISP and General Customization

Reply
*Schamenek, Alex
Message 1 of 7 (496 Views)

Can I change plot style with lisp?

496 Views, 6 Replies
02-21-2001 05:18 AM
Is there a way for me to change a layers plot style from one to another with
LISP?
We use named plot styles, STB's not CTB's.

I want to be able to create an icon that will change all layers with the
plotstyle "normal" to "black".
Is this possible with lisp?
Distinguished Contributor
rebel
Posts: 168
Registered: ‎04-10-2001
Message 2 of 7 (496 Views)

Re: Can I change plot style with lisp?

02-21-2001 10:58 PM in reply to: *Schamenek, Alex
Alex, the following code has no error checking, assumes the drawing is already in Style dependant mode, and Style "Black" is in the currently defined STB.
;;;
;;;James Buzbee
;;;
(defun jb:NormaltoBlack( / )
(setq layers(vla-get-layers(vla-get-ActiveDocument(vlax-get-acad-object))))
(vlax-for l layers
(progn
(if (= (vlax-get-property l 'PlotStyleName) "Normal")
(vlax-put-property l 'PlotStyleName "Black")
)
)
)
)
;;;
;;;
;;;
Active Contributor
scotts
Posts: 30
Registered: ‎07-25-2008
Message 3 of 7 (439 Views)

Re: Can I change plot style with lisp?

12-01-2011 01:41 PM in reply to: rebel

James,

 

I can get the lisp to load, but can't seem to get it to run.  Also can I repeat the code if I have multiple plot styles I want to replace (i.e. style_01 with black, style_02 with Screened50, etc...)

 

Your help is greatly appreciated!

 

-Scott

Contributor
pdx271
Posts: 16
Registered: ‎02-27-2007
Message 4 of 7 (393 Views)

Re: Can I change plot style with lisp?

01-03-2012 02:29 PM in reply to: *Schamenek, Alex

Remove the "?" in VLIDE, there was a mystery question mark once i pasted into VLIDE.

It does not show here.

 

- I modified it for my needs.

 

 

(defun NormaltoFS (/)
  (setq layers (vla-get-layers
   (vla-get-ActiveDocument (vlax-get-acad-object))
        )
  )
  (vlax-for l layers
    (progn
      (if (= (vlax-get-property l 'PlotStyleName) "Normal")
 (vlax-put-property l 'PlotStyleName "Full Saturation")
      )
    )
  )
)

Active Member
SoftwareSupport
Posts: 6
Registered: ‎01-28-2013
Message 5 of 7 (264 Views)

Re: Can I change plot style with lisp?

02-08-2013 07:35 AM in reply to: *Schamenek, Alex

Not sure if you guys are still alive but...

 

What if I wanted to exclude a few layers from this routine:

 

(defun c:WPS    (/)
  (setq    layers (vla-get-layers
         (vla-get-ActiveDocument (vlax-get-acad-object))
           )
  )
  (vlax-for l layers
    (progn
      (if (= (vlax-get-property l 'PlotStyleName) "Normal")
    (vlax-put-property l 'PlotStyleName "Medium")
      )
    )
  )
)

*Expert Elite*
pbejse
Posts: 2,406
Registered: ‎11-24-2009
Message 6 of 7 (252 Views)

Re: Can I change plot style with lisp?

02-09-2013 04:17 AM in reply to: SoftwareSupport

SoftwareSupport wrote:

Not sure if you guys are still alive but...

 

What if I wanted to exclude a few layers from this routine:

 


 

(defun c:WPS    (/)
  (setq    layers (vla-get-layers
         (vla-get-ActiveDocument (vlax-get-acad-object))
           )
  )
  (vlax-for l layers
    (progn
      (if (and (= (vlax-get-property l 'PlotStyleName) "Normal")
               (not (member (strcase (vla-get-name l)) '("EXCLUDEDLAYER1" "EXCLUDEDLAYER2"))))
    (vlax-put-property l 'PlotStyleName "Medium")
      )
    )
  )
)

 

HTH

Active Member
SoftwareSupport
Posts: 6
Registered: ‎01-28-2013
Message 7 of 7 (245 Views)

Re: Can I change plot style with lisp?

02-09-2013 07:31 AM in reply to: pbejse

That did it! Problem solved. Thanks a ton!

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community