Solved! Go to Solution.
Solved by dbroad. Go to Solution.
If you mean a paper space viewport, then you should be able to use bpoly after drawing the line (twice). Copy the viewport and clip each one to the new closed polylines.
@rulep21 wrote:english please.
I don't understand.
Hahaha...
smileyvery-happy:
Why did you mark the reply as SOLVED since that odd reply is not clear or correct at least ?
Sorry for that guys.
Actually dbroad and daneson gave me an idea on how to create this code.
It's just that daneson helped me personally with this code that's why I marked it as solution.
I'm really sorry for that. I'm just a newbie here and I haven't read yet the rules and regulation on this forum.
Anyway guys, here's the code for splitting viewport.
;;;;;;written by roldan r. ulep;;;;; ;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;viewport split;;;;;;;;;;;;;;;; (defun c:vpsplit () (setq vp (ssget '((0 . "VIEWPORT")))) (setq b1 (getpoint"\nPick point")) (setq b2 (getpoint"\nPick point")) (setq b3 (getpoint"\nPick point")) (command "layer" "s" "G-VPORT" "") (command "bpoly" b1 "") (setq clip1 (entlast)) (command "bpoly" b2 "") (setq clip2 (entlast)) (command "bpoly" b3 "") (setq clip3 (entlast)) (command "copy" vp "" "0,0,0" "0,0,0" "") (setq vp2 (entlast)) (command "copy" vp2 "" "0,0,0" "0,0,0" "") (setq vp3 (entlast)) (command "vpclip" vp clip1 "") (command "vpclip" vp2 clip2 "") (command "vpclip" vp3 clip3 "") (command "regen" "") (princ) )
@rulep21 wrote:
Sorry for that guys.
Actually dbroad and daneson gave me an idea on how to create this code.
It's just that daneson helped me personally with this code that's why I marked it as solution.
I'm really sorry for that. I'm just a newbie here and I haven't read yet the rules and regulation on this forum.
Now it makes sense, too bad we arent privy to your discussion with Daneson. it would've been clearer to the rest of us.
FWIW Dbroads' suggestion is right on the money, I would have coded it diffrerently though. for one thing, it would'nt be limited to 3 viewports.
Anyhoo, Happy coding
Hi pbe
Can you modify it as per your suggestion?
I think that will be much better.
Or maybe change the bpoly method in creating boundary by selecting both lines and viewport.
@Anonymous wrote:
Hi pbe
Can you modify it as per your suggestion?
I think that will be much better.
Or maybe change the bpoly method in creating boundary by selecting both lines and viewport.
Guess i can write a code using that approach, question is, do you still need another routine on top of what you already have? One you wrote seems to be working well for you.
@rulep21 wrote:
yes it's working but i need your help to improve it.
Sure, no problem.
Heres a code using LINES as reference for number of split. I cant say its an improvement though <Not thoroughly tested>
(defun c:vsplit (/ _dxf _3p splitdata vp refline opt e cp c box sp ep Thisare el box ) ;;; pBe May2014 ;;; (defun _dxf (d en) (cdr (assoc d (entget en)))) (defun _3p (lst) (if lst (cons (list (car lst) (cadr lst) (caddr lst)) (_3p (cdddr lst)) ) ) ) (princ "\nSelect Viewport") (if (and (setq splitdata nil Thisare nil vp (ssget "_:S:L" '((0 . "Viewport"))) ) (null (redraw (setq e (ssname vp 0)) 3)) (princ "\nSelect Reference lines") (setq refline (ssget "_:L" '((0 . "LINE")))) (null (initget "Vertical Horizontal")) (setq opt (getkword "[Vertical/Horizontal]: ")) ) (progn (redraw e 4) (setq cp (_dxf 10 e)) (setq c (if (eq opt "Vertical") car cadr ) ) (vla-GetBoundingBox (setq e (vlax-ename->vla-object e)) 'll 'ur ) (setq box (mapcar 'vlax-safearray->list (list ll ur))) (repeat (setq i (sslength refline)) (setq sp (_dxf 10 (setq el (ssname refline (setq i (1- i))))) ep (_dxf 11 el) ) (if (and (= (c ep) (c sp)) (setq bnd (vlax-invoke e 'IntersectWith (vlax-ename->vla-object el) acExtendNone ) ) ) (setq Thisare (cons el Thisare) splitdata (cons (_3p bnd) splitdata)) ) ;(entdel el) ) (if (setq splitdata (vl-sort splitdata '(lambda (j k) (< (distance (Car box) (Car j)) (distance (Car box) (Car k)) ) ) ) ) (progn (foreach dat splitdata (setq vpe (vlax-vla-object->ename (vla-copy e))) (command "_rectang" "_non" (car box) "_non" (car dat)) (command "vpclip" vpe (entlast)) (setq box (list (cadr dat) (cadr box))) ) (command "_rectang" "_non" (car box) "_non" (cadr box)) (command "vpclip" (vlax-vla-object->ename e) (entlast)) (foreach ent Thisare (entdel ent)) )(princ (strcat "\n<<< No " opt " Lines selected >>>")) ) ) )(princ) ) (vl-load-com)
HTH