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

named vieport

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
EgoonS
613 Views, 9 Replies

named vieport

hi all, whom of the many readers of this forum has a lisp that delete multiple named vieport in model space at once? share please.

 

many thanks!

Gee

9 REPLIES 9
Message 2 of 10
_Tharwat
in reply to: EgoonS

This ?

 

(defun c:Test (/ v)
  (while (setq v (tblnext "VIEW" (null v)))
    (if (eq (cdr (assoc 70 v)) 0)
      (vla-delete
        (vla-item (vla-get-views
                    (vla-get-ActiveDocument (vlax-get-acad-object))
                  )
                  (cdr (assoc 2 v))
        )
      )
    )
  )
  (princ)
)(vl-load-com)

 

Message 3 of 10
EgoonS
in reply to: _Tharwat

HI Thalwart, thanks for your effort..i'd tried but it doesn't work. im using acad2012 that maybe the case?
TiA
Message 4 of 10
Lee_Mac
in reply to: EgoonS

Maybe something along the lines of:

 

(defun c:dvp ( )
    (vlax-map-collection
        (vla-get-viewports (vla-get-activedocument (vlax-get-acad-object)))
        'vla-delete
    )
    (princ)
)
(vl-load-com) (princ)

 

Message 5 of 10
EgoonS
in reply to: Lee_Mac

thanks Lee_Mac. that solved the issue.
Message 6 of 10
Kent1Cooper
in reply to: EgoonS


@EgoonS wrote:

... a lisp that delete multiple named vieport in model space at once? ....


Another way, if you're looking to get rid of all named model-space Viewport configurations:

 

(command "_.model" "_.vports" "_delete" "*" "" "_single")

 

You could stop with the "*" if you don't mind being left in whatever Viewport configuration you're in at the time, even if it no longer has a name.

 

But if by "multiple" you don't necessarily mean all, you can do this if you know the names, with a comma-separated list of them:

 

(command "_.model" "_.vports" "_delete" "VPName2,VPName3,VPName8")

Kent Cooper, AIA
Message 7 of 10
Lee_Mac
in reply to: EgoonS

You're welcome EgoonS - glad it helps.

Message 8 of 10
_Tharwat
in reply to: EgoonS


@EgoonS wrote:
HI Thalwart, thanks for your effort..i'd tried but it doesn't work. im using acad2012 that maybe the case?
TiA

I am sorry , I thought that you want to delete views that are in Model space only whilst you need to delete viewports .

Message 9 of 10
EgoonS
in reply to: Kent1Cooper

thanks Kent to your suggestion
Message 10 of 10
EgoonS
in reply to: _Tharwat

no worries here..anyways, many of you guys made our work much easier.

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

Post to forums  

Autodesk Design & Make Report

”Boost