Jump to content

lisp tool to convert closed polyline to a viewport - help me make it better.


fuqua

Recommended Posts

the tool only runs fine 1 time and then it gets broken, seems like it can use it only 1 time per layout ?

 

can someone help me figure out whats wrong with it ?

 

what i have so far.:

 

;;; vpcl-create-viewport-from-a-polyline
;;; version 0.2
;;; 
(defun c:vpcl (/ clgr vpla ; polyline viewport-orriginal
             )
 (princ "\n**select-polyline\n")
 (command "_mspace") ;to be sure
 (setq clgr (car (entsel "Select polyline to convert.") ) )
 (princ "\n**chspace\n")
 (command "_chspace" clgr "" )
 (princ "\n**pspace\n")
 (command "_pspace")
 (princ "\n**vports\n")
 (command "-vports" "o" clgr )
 (princ "\n**select-vp\n")
 (setq vpla (car (entsel "Select main viewport to sync with.") ) )
 (princ "\n**vpsync"\n)
 (command "_vpsync" );vpla clgr "\n" )
 (princ "\n**ready\n")
)

Link to comment
Share on other sites

  • Replies 28
  • Created
  • Last Reply

Top Posters In This Topic

  • fuqua

    15

  • Tharwat

    9

  • alanjt

    2

  • mdbdesign

    1

Don't need for lisp...

 

Command: _-vports

Specify corner of viewport or

[ON/OFF/Fit/Shadeplot/Lock/Object/Polygonal/Restore/LAyer/2/3/4] : o

Select object to clip viewport:

Link to comment
Share on other sites

You can also do it with the MView command.

eg.

Command: mv
MVIEW
Specify corner of viewport or 
[ON/OFF/Fit/Shadeplot/Lock/Object/Polygonal/Restore/LAyer/2/3/4] <Fit>: o
Select object to clip viewport: Regenerating model.

Command: Specify opposite corner:

Link to comment
Share on other sites

Also have titleblock in layout have a large model view approx title block you can use chspace to drag your polyline to paperspace then MV ob pick pline erase outside model view not needed anymore.

 

Sorry read Alans again but with chspace added

Link to comment
Share on other sites

btw i dont want any clipping done, the idea with the viewport inside a viewport is to have everything grayed out inside the big viewport and the newly created viewport colors should stay intact.

 

like highlighting a certain area which u want to focus on without losing oversight of the rest of the drawing.

Link to comment
Share on other sites

  • 3 weeks later...

;;; vpcl-viewport-van-clustergrens
;;; versie 0.2
;;; 
(defun c:vpcl (/ clgr;
             )
 (command "_mspace") ;voor de zekerheid
 (setq clgr (entsel "Select clustergrens om te converteren.") )
 (command "_chspace" (car clgr) "" )
 (command "_pspace")
 (command "-vports" "o" clgr ) ;assume last created object is our viewport
 (princ "")
 ;Here is the place to implement a "VPSYNC"-like routine
 ;followed by vp-plotstyle overrides voor de `master'viewport
)

 

here is a update on the tool we making, only trouble appear we cant use vpsync inside the lisp :( any help on that ?

Link to comment
Share on other sites

This may help you with it buddy . :)

 

(defun c:vpcl (/ ss ent)
 ;; Tharwat 26. 07. 2011
 (cond ((not
          (eq (vla-get-Activespace
                (vla-get-activedocument (vlax-get-acad-object))
              )
              acPaperSpace
          )
        )
        (princ "\n ** Command not allowed in Model Tab ** ")
       )
       ((not (and (setq ss (ssget "_+.:L:S" '((0 . "LWPOLYLINE"))))
                  (vlax-curve-isclosed (setq ent (ssname ss 0)))
             )
        )
       )
       ((command "_.mview" "_object" ent))
 )
 (princ)
)

 

Tharwat

Link to comment
Share on other sites

This may help you with it buddy . :)

 

(defun c:vpcl (/ ss ent)
 ;; Tharwat 26. 07. 2011
 (cond ((not
          (eq (vla-get-Activespace
                (vla-get-activedocument (vlax-get-acad-object))
              )
              acPaperSpace
          )
        )
        (princ "\n ** Command not allowed in Model Tab ** ")
       )
       ((not (and (setq ss (ssget "_+.:L:S" '((0 . "LWPOLYLINE"))))
                  (vlax-curve-isclosed (setq ent (ssname ss 0)))
             )
        )
       )
       ((command "_.mview" "_object" ent))
 )
 (princ)
)

 

Tharwat

 

thanks mate ! but does this also sync the 2 viewports ?

Link to comment
Share on other sites

If you talking about the command vpsync I say no , it just convert a lwpolyline to a viewport .

 

ok thank you, that atleast helps us solve part of the puzzle :)

 

do you have any idea how we can get the vpsync working ? we figured out vpsync is a .lsp but we cant figure out which part does the syncing.

Link to comment
Share on other sites

You're welcome .:)

 

Why the vpsync is not working for you ?

 

vpsync is a lisp tool itself, and it appears u cant make a call for another .lsp from within a .lsp

Link to comment
Share on other sites

If you talking about the command vpsync I say no , it just convert a lwpolyline to a viewport .

 

oke mate, with the help of lee mac we got the vpsync command going. it does appear we have a still a small problem (i hope) with the chspace command if there is already more then 1 viewport.

Link to comment
Share on other sites

oke mate, with the help of lee mac we got the vpsync command going. it does appear we have a still a small problem (i hope) with the chspace command if there is already more then 1 viewport.

 

Where is the question ? :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...