For the layer issue, I wrote a reactor that will place Viewports/Images/XRefs on the defined layers. Interested in that? It wouldn't be too terribly difficult to code what you want.
Registered forum members do not see this ad.
Let me start by saying that I have NO AutoLISP programming knowledge at all.
I'm having a bit of trouble getting all of my people to do a few specific things with their viewports. I've asked them numerous times to do the following:
- Lock all viewports
- Change all viewport visual styles to 2D wireframe
- Put all viewports on the "VIEWPORTS" layer
It may be that I'm asking too much, but a couple of my guys still have unlocked viewports that won't print properly due to the visual style. They've gotten better, but a few will creep up every now and then, so I'm looking for a code that would complete the tasks I've listed above. I've tried searching for a code already but it doesn't look like one exists.
Would one of you LISP guru's be so kind as to help a fellow CAD monkey out?
Chuck Norris counted to infinity...
Twice.
For the layer issue, I wrote a reactor that will place Viewports/Images/XRefs on the defined layers. Interested in that? It wouldn't be too terribly difficult to code what you want.
DropBox | finding the light...
Seann: ...it went crazy ex-girlfriend on me...
eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...
Sketched this up pretty quick,Alan, could you check the line that I marked?
vla-put-VisualStyle doesn't seem to be documented either.Code:(defun c:test ( / doc ss vl ) (vl-load-com) (setq vl "VIEWPORTS") ;; VP Layer (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (or (tblsearch "LAYER" vl) (vla-Add (vla-get-layers doc) vl) ) (cond ( (ssget "_X" '((0 . "VIEWPORT"))) (vlax-for vport (setq ss (vla-get-ActiveSelectionSet doc)) (vla-put-VisualStyle vport 1) (vla-put-layer vport vl) (vla-put-DisplayLocked vport :vlax-true) ) (vla-delete ss) ) ) (princ) )![]()
Last edited by Lee Mac; 4th Oct 2010 at 08:59 pm.
Lee Mac Programming
With Mathematics there is the possibility of perfect rigour, so why settle for less?
Just another Swamper
When the issue with Visual Styles is perhaps ironed out, maybe as a save reactor?
Reactor is initiated upon loading, can be toggled off by typing "VPortReactor"Code:(defun c:VPortFix ( / doc ss vl ) (vl-load-com) (setq vl "VIEWPORTS") ;; VP Layer (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (or (tblsearch "LAYER" vl) (vla-Add (vla-get-layers doc) vl) ) (cond ( (ssget "_X" '((0 . "VIEWPORT"))) (vlax-for vport (setq ss (vla-get-ActiveSelectionSet doc)) (vla-put-VisualStyle vport 1) (vla-put-layer vport vl) (vla-put-DisplayLocked vport :vlax-true) ) (vla-delete ss) ) ) (princ) ) (defun c:VPortReactor nil (vl-load-com) ( (lambda ( data foo / react ) (if (setq react (vl-some (function (lambda ( reactor ) (if (eq data (vlr-data reactor)) reactor) ) ) (cdar (vlr-reactors :vlr-editor-reactor)) ) ) (if (vlr-added-p react) (vlr-remove react) (vlr-add react) ) (setq react (vlr-editor-reactor data (list (cons :vlr-beginsave foo) ) ) ) ) (princ (if (vlr-added-p react) "\n** Reactor Activated **" "\n** Reactor Deactivated **" ) ) react ) "VPort-Reactor" 'VPort-CallBack ) (princ) ) (defun VPort-CallBack ( reactor arguments ) (c:VPortFix)) (c:VPortReactor)
Last edited by Lee Mac; 4th Oct 2010 at 08:59 pm.
Lee Mac Programming
With Mathematics there is the possibility of perfect rigour, so why settle for less?
Just another Swamper
Works on my end. 1 is 2dwireframe and 2 is 3dhidden. Set the property, activate the viewport and type VSCurrent.
DropBox | finding the light...
Seann: ...it went crazy ex-girlfriend on me...
eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...
Lee Mac Programming
With Mathematics there is the possibility of perfect rigour, so why settle for less?
Just another Swamper
DropBox | finding the light...
Seann: ...it went crazy ex-girlfriend on me...
eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...
DropBox | finding the light...
Seann: ...it went crazy ex-girlfriend on me...
eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...
I would make this change to account for clipped viewports...
Code:(defun c:VPortFix (/ doc ss vl) (vl-load-com) (setq vl "VIEWPORTS") ;; VP Layer (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (or (tblsearch "LAYER" vl) (vla-Add (vla-get-layers doc) vl) ) (cond ((ssget "_X" '((0 . "VIEWPORT"))) (vlax-for vport (setq ss (vla-get-ActiveSelectionSet doc)) (vla-put-VisualStyle vport 1) (vla-put-layer vport vl) (vla-put-DisplayLocked vport :vlax-true) ;; AT edit begin (if (eq (vla-get-Clipped vport) :vlax-true) (vla-put-layer (vlax-ename->vla-object (cdr (assoc 340 (entget (vlax-vla-object->ename vport))))) vl ) ) ;; AT edit end ) (vla-delete ss) ) ) (princ) )
DropBox | finding the light...
Seann: ...it went crazy ex-girlfriend on me...
eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...
Bookmarks