Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SSM and Viewport layer

10 REPLIES 10
Reply
Message 1 of 11
Anonymous
945 Views, 10 Replies

SSM and Viewport layer

I don't understand why I cannot tell SSM what layer I want my viewport to come in on. It only comes in on my active layer. But if my active layer is a no plot layer I have to change the layer of my view block to a notes layer. I have tired a reactor for viewports to see if it would change the layer, but this does not work. can some other code work? Am I missing a setting?
10 REPLIES 10
Message 2 of 11
Anonymous
in reply to: Anonymous

I wrote this, when the ssm was introduced... and been using it since.

Just make sure that the viewport layer exist, before using the below
code.... and it is provided as-is - HTH.


;; by default turn the ability ON
(if (or (eq (getenv "RunPlaceViewLayer") nil)
(eq (getenv "RunPlaceViewLayer") ""))
(setenv "RunPlaceViewLayer" "1"))

(defun reactor-editor (reactor params)
(if (eq (getenv "RunPlaceViewLayer") "1")
(progn (if (not (wcmatch
(getvar "cmdnames")
"UNDO,U,REDO,OOPS,STYLE,COPYCLIP,COPYBASE,CUTCLIP"))
(progn (if (and (wcmatch (strcase (car params)) "PLACEVIEW")
posible_viewport_ename
posible_viewport_enames)
(progn ;; set the new viewport to the right layer
(vla-put-layer
(vlax-ename->vla-object posible_viewport_ename)
"VIEWPORT")
(setq posible_viewport_ename nil)
(setq posible_viewport_enames nil)))))
(setq posible_viewport_ename nil)
(setq posible_viewport_enames nil))))

(defun acdb-objectappended (reactor params)
(if
(and
(eq (getenv "RunPlaceViewLayer") "1")
(not
(wcmatch
(getvar "cmdnames")
"UNDO,U,REDO,OOPS,STYLE,COPYCLIP,COPYBASE,CUTCLIP,NEW,QNEW,OPEN,*LAYOUT*,MOVE,COPY,*STRETCH*")))
(cond ((and (wcmatch (getvar "cmdnames") "PLACEVIEW")
params
(entget (cadr params))
(eq (cdadr (entget (cadr params))) "VIEWPORT")
(not (vl-position (cadr params) posible_viewport_enames)))
(setq posible_viewport_ename (cadr params))
(setq posible_viewport_enames (cons (cadr params)
posible_viewport_enames))))))

(if (not dwiz_editor_reactor)
(setq dwiz_editor_reactor
(vlr-set-notification
(vlr-editor-reactor
"editor"
'((:vlr-commandended . reactor-editor)
(:vlr-commandcancelled . reactor-editor)))
'active-document-only)))

(if (not dwiz_acdb_reactor)
(setq dwiz_acdb_reactor
(vlr-set-notification
(vlr-acdb-reactor
"acdb"
'((:vlr-objectappended . acdb-objectappended)))
'active-document-only)))


ie. for the layer I still use something like this inside a lsp file, that is
loaded on each drawing session...:

(acad-push-dbmod)
(setvar "cmdecho" 0)
(setq layer (getvar "clayer"))

(if (not (tblsearch "layer" "VIEWPORT"))
(command "_.layer" "_m" "VIEWPORT" "_c" "1" "" "_p" "_n" "" ""))

(if layer
(setvar "clayer" layer))
(setq layer nil)
(setvar "cmdecho" 1)
(acad-pop-dbmod)
(princ)


have fun

wrote in message news:5439998@discussion.autodesk.com...
I don't understand why I cannot tell SSM what layer I want my viewport to
come in on. It only comes in on my active layer. But if my active layer is
a no plot layer I have to change the layer of my view block to a notes
layer. I have tired a reactor for viewports to see if it would change the
layer, but this does not work. can some other code work? Am I missing a
setting?
Message 3 of 11
Anonymous
in reply to: Anonymous

My viewport layer is PSL-0-XLINES. I put that name in where ever you had "VIEWPORT" and I still could not get my layer change to work. I am running AutoCAD 2007 is this code for some other version, it is loading the lisp when I call up the place view on sheet, it is just not changing the layer.
Message 4 of 11
Anonymous
in reply to: Anonymous

I didn't see a vl-load-com in Luis code?

Luis: too bad ADT doesn't fire a command when xreffing from the Project
Navigator! very frustrating. How were the holidays - good for you?

jb
Message 5 of 11
Anonymous
in reply to: Anonymous

Grab the code again, and make your change were reads..:

(progn ;; set the new viewport to the right layer
(vla-put-layer
(vlax-ename->vla-object posible_viewport_ename)
"VIEWPORT") ;;<<<<< in there add your own layer name


Try again and should work. 🙂


wrote in message news:5440183@discussion.autodesk.com...
My viewport layer is PSL-0-XLINES. I put that name in where ever you had
"VIEWPORT" and I still could not get my layer change to work. I am running
AutoCAD 2007 is this code for some other version, it is loading the lisp
when I call up the place view on sheet, it is just not changing the layer.
Message 6 of 11
Anonymous
in reply to: Anonymous

Thank you this code is going to save a lot of time
Message 7 of 11
Anonymous
in reply to: Anonymous

Hi James!

I still in mint chocolate autocad, no idea about adt nowdays.... 😞

The holidays were very good!, still on vacations 🙂

Hope yours were fine too!


Take care.



>Luis: too bad ADT doesn't fire a command when xreffing from the Project
>Navigator! very frustrating. How were the holidays - good for you?
Message 8 of 11
Anonymous
in reply to: Anonymous

mint chocolate AutoCAD - HA! you are still on vacation!!

This will be a very good year - I can feel it. Glad you all are enjoying
the season . . .

jb
Message 9 of 11
Anonymous
in reply to: Anonymous

Is there also a reactor that I could use for the Callout Blocks to come in on some certain layer? I tried to modify your code for this, but I am pretty clue less when it comes to reactors.
Message 10 of 11
jpCADconsulting
in reply to: Anonymous

I second that last post, The view-port reactor is brilliant!!! - thanks for that.

 

But I'd love for the label block for the view to go on a specific layer as well.

 

I'm also crap at reactors at the moment so any help is much appreciated!

 

Thanks!

 

-JP

Message 11 of 11

Hey gang,

 

I recently revisited this and made some headway.

 

Lee Mac's Layer Director does indeed work in some of these situations. I was just in the dar about what commands were being issued when you place a view/callout using the SSM.  So here is the code I used in Lee's routine (SSM commands in RED):

 

;;-----------------------------------------------------------------------------------------------------------------------------------------------------;;
;;  Command Pattern  |  Layer Name    |       Description       |    Colour    |   Linetype   |    Lineweight    |       Plot       |    Plot Style    ;;
;;-----------------------------------------------------------------------------------------------------------------------------------------------------;;
;;     [string]      |   [string]     |         [string]        | 0 < int <256 |   [string]   | -3 = Default     |  1 = Will Plot   |     [string]     ;;
;;                   |                |     Use "" for none     |              |              |  0 <= int <= 211 |  0 = Won't Plot  |  Use nil for CTB ;;
;;-----------------------------------------------------------------------------------------------------------------------------------------------------;;


("*PLACEVIEW*"             "L-PS-VPORT"      "Paper Space - Viewport, NO PLOT"                             5        "Continuous"           -3                 0                 nil         )
("*CALLOUT*"             "L-ANNO-SYMB"      "Annotations - Symbols"                             3        "Continuous"           -3                 1                 nil         )

So using this, viewports go on the correct layer when view is placed for the SSM and placed callout do too, however, when placing a view, the callout that is placed along with it still goes on the current layer.

 

Any help in figuring out which command is issue to place that block is appreciated, as alwasy

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost