Tharwat Posted July 26, 2011 Share Posted July 26, 2011 you really gonna make me form a decent question ? I am really do not know what you want to do ? can you explain it or it is hard ? I am going home right now but I will resume when I arrive . So take your time to make it clear . Quote Link to comment Share on other sites More sharing options...
fuqua Posted July 26, 2011 Author Share Posted July 26, 2011 I am really do not know what you want to do ? can you explain it or it is hard ? I am going home right now but I will resume when I arrive . So take your time to make it clear . lol ok when using the chspace command in the lisp tool it gives some trouble, we think it cause it does not know which viewport to choose from since we got 2 viewports (1 small 1 big) how can we make clear in the tool which viewport it should use to convert the closed polyline to a new viewport ? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 26, 2011 Share Posted July 26, 2011 Are you trying to move the closed polyline to model space through the command chspace ? or as we did before convert it to be Viewport ? Post your codes to let us see . Quote Link to comment Share on other sites More sharing options...
alanjt Posted July 26, 2011 Share Posted July 26, 2011 Just saw this thread and thought I'd comment on tharwat's code. You could condense things down a bit. I know you are coding for single selection, but when multiple is available, why not... (defun c:LWP2VP (/ ss i) (cond ((> (getvar 'CVPORT) 1) (princ "\n ** Command not allowed in Model Tab ** ")) ((setq ss (ssget "_:L" '((0 . "LWPOLYLINE") (-4 . "&=") (70 . 1)))) (repeat (setq i (sslength ss)) (command "_.mview" "_object" (ssname ss (setq i (1- i))))) ) ) (princ) ) Also, no VLISP required. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 26, 2011 Share Posted July 26, 2011 Nicely done Alanjt . Thank you. Quote Link to comment Share on other sites More sharing options...
fuqua Posted July 26, 2011 Author Share Posted July 26, 2011 Are you trying to move the closed polyline to model space through the command chspace ? or as we did before convert it to be Viewport ? Post your codes to let us see . ;;; 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") ) this is how we used to do it; we are pushing a closed polyline to modelspace and then convert it to be a viewport, then that viewport has to sync with the already existing main viewport. so it has the right scale and location. trouble we are having is it does not know which (existing) viewport to choose from since we got 2 and a 3th has to be created and synced up with the big viewport. Quote Link to comment Share on other sites More sharing options...
fuqua Posted July 26, 2011 Author Share Posted July 26, 2011 Just saw this thread and thought I'd comment on tharwat's code. You could condense things down a bit. I know you are coding for single selection, but when multiple is available, why not... (defun c:LWP2VP (/ ss i) (cond ((> (getvar 'CVPORT) 1) (princ "\n ** Command not allowed in Model Tab ** ")) ((setq ss (ssget "_:L" '((0 . "LWPOLYLINE") (-4 . "&=") (70 . 1)))) (repeat (setq i (sslength ss)) (command "_.mview" "_object" (ssname ss (setq i (1- i))))) ) ) (princ) ) Also, no VLISP required. how can we implement this is in our tool (vlisp) and what do you exactly mean by "no vlisp required" ? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 27, 2011 Share Posted July 27, 2011 this is how we used to do it; we are pushing a closed polyline to modelspace and then convert it to be a viewport, then that viewport has to sync with the already existing main viewport. so it has the right scale and location. trouble we are having is it does not know which (existing) viewport to choose from since we got 2 and a 3th has to be created and synced up with the big viewport. What we have been discussing til now ? You still talking about you precious routine and we are talking about converting a LWpolyline to Viewport . I would stop at this point . Bye . Quote Link to comment Share on other sites More sharing options...
fuqua Posted July 27, 2011 Author Share Posted July 27, 2011 What we have been discussing til now ? You still talking about you precious routine and we are talking about converting a LWpolyline to Viewport . I would stop at this point . Bye . sorry wrong code, this is what we have so far with your help and the tip we got from lee mac, gonna try alanjt bit of code to (i understand it solved the 2 viewport issue, right ?) ;;; vpcl-viewport-van-clustergrens ;;; versie 0.2 ;;; (defun c:vpcl (/ clgr ss ent; ) (command "_mspace") ;voor de zekerheid (setq clgr (entsel "Select polyline to convert: ") ) (command "_chspace" (car clgr) "" ) (command "_pspace") ;; Tharwat 26. 07. 2011 (princ"\n") (vl-load-com) (princ "Select polyline to convert to viewport ") (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 "vports..\n") ; (command "-vports" "O" "L" ) ;assume last created object is our viewport (princ "\nSelect master viewport: ") (c:vpsync) ;followed by vp-plotstyle overrides voor de `master'viewport ) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.