Author Topic: Viewport overrides using visual lisp  (Read 3233 times)

0 Members and 1 Guest are viewing this topic.

Chris

  • Swamp Rat
  • Posts: 548
Viewport overrides using visual lisp
« on: November 20, 2015, 06:46:52 AM »
Does anyone have an example of using visual lisp to place viewport overrides on a layer?

Thanks,
Christopher T. Cowgill, P.E.
AEC Collection 2020 (C3D)
Win 10

jvillarreal

  • Bull Frog
  • Posts: 332
Re: Viewport overrides using visual lisp
« Reply #1 on: November 20, 2015, 03:07:26 PM »
There's an example of freezing a layer, in this thread:
http://www.theswamp.org/index.php?topic=22264.0

As well as an awesome lsp/dcl/arx combo for controlling viewport layer display:
http://www.theswamp.org/index.php?topic=22264.msg290340#msg290340

Chris

  • Swamp Rat
  • Posts: 548
Re: Viewport overrides using visual lisp
« Reply #2 on: November 20, 2015, 03:15:53 PM »
Specifically, I'm trying to figure out how to change the lineweight of a layer.
Christopher T. Cowgill, P.E.
AEC Collection 2020 (C3D)
Win 10

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Viewport overrides using visual lisp
« Reply #3 on: November 24, 2015, 03:21:17 AM »
Layer visibility overrides are stored as Xdata attached to the viewport. All other layer overrides are stored as dictionary data in layer extension dictionaries. To collect all layer override data for a single vp you need to check the vp and all layers. It is not difficult, but it is quite a palaver. I do have code for this but can't release it as open source. Sorry.

Maybe this will help you get started:

Code - Auto/Visual Lisp: [Select]
  1. (defun c:Test ( / lyr ext rec)
  2.   (setq lyr (tblobjname "layer" "MyLayer"))
  3.   (if (setq ext (cdr (assoc 360 (entget lyr))))
  4.     (dictsearch ext "ADSK_XREC_LAYER_LINEWT_OVR")
  5.   )
  6. )

Code: [Select]
(c:TEST) =>
(
  (-1 . <Entity name: cc38d28>)
  (0 . "XRECORD")
  (5 . "D5")
  (102 . "{ACAD_REACTORS")
  (330 . <Entity name: 1a1d4978>)
  (102 . "}")
  (330 . <Entity name: 1a1d4978>)
  (100 . "AcDbXrecord")
  (280 . 1)
  (102 . "{ADSK_LYR_LINEWT_OVERRIDE")
  (335 . <Entity name: cc06d10>)       ; Ename of viewport.
  (91 . 18)                            ; Override value.
  (102 . "}")
  (102 . "{ADSK_LYR_LINEWT_OVERRIDE")
  (335 . <Entity name: caa6d50>)       ; Ename of viewport.
  (91 . 211)                           ; Override value.
  (102 . "}")
)

The names used for the Xrecords are:
ADSK_XREC_LAYER_COLOR_OVR
ADSK_XREC_LAYER_LINETYPE_OVR
ADSK_XREC_LAYER_LINEWT_OVR
ADSK_XREC_LAYER_ALPHA_OVR
ADSK_XREC_LAYER_PLOTSTYLE_OVR

Chris

  • Swamp Rat
  • Posts: 548
Re: Viewport overrides using visual lisp
« Reply #4 on: November 24, 2015, 06:12:05 AM »
This at least gives me a starting point, I'll take a look at it and see what I can figure out.  Thank you.
Christopher T. Cowgill, P.E.
AEC Collection 2020 (C3D)
Win 10