Author Topic: routine to change viewport to 2d wireframe  (Read 1705 times)

0 Members and 1 Guest are viewing this topic.

Offline CadDadTopic starter

  • Premier Member
  • *****
  • Posts: 749
  • Country: us
  • Gender: Male
routine to change viewport to 2d wireframe
« on: Aug 12, 2013, 18:31:33 PM »
I am trying to write a lisp that sets a viewport visualstyle to '2d wireframe' dxf code (281 . 0)
Below is the code. I get the entity dxf list to change from (281 . 6) to (281 . 0) but it does not change when 'entmod' is applied to 'enlist2' It returns nil which I would expect it to return the updated list.

Anyone have any ideas about this one?

Code: [Select]
(defun c:shadeview-1 ()
(setvar "cmdecho" 0)
(setvar "psltscale" 0)
(setvar "ltscale" 12)
(setq ent (car (entsel "\nselect viewport: ")))
(setq enlist (entget ent))
(setq enlist2 (subst (cons 281 0)(assoc 281 enlist) enlist2))
(entmod enlist2)
(entupd ent)
)

Offline cjehly

  • Premier Member
  • *****
  • Posts: 1244
  • Country: us
  • Gender: Male
Re: routine to change viewport to 2d wireframe
« Reply #1 on: Aug 15, 2013, 07:58:13 AM »
no idea about your code, but you can't change visual styles without forcing a regen, and if someone says otherwise, I'll sit back and take notes.
-Chris-

Offline petergranlund

  • Full Member
  • ***
  • Posts: 160
  • Country: us
  • Gender: Male
Re: routine to change viewport to 2d wireframe
« Reply #2 on: Aug 15, 2013, 13:00:19 PM »
The 3rd argument to the subst statement is not a valid list.

Change this line
(setq enlist2 (subst (cons 281 0)(assoc 281 enlist) enlist2))

To this
(setq enlist2 (subst (cons 281 0)(assoc 281 enlist) enlist))

Peter Granlund
Fabrication 2019
AutoCad 2019
Revit 2019
HP Elite Book 8770W