s1222s Posted September 15, 2012 Posted September 15, 2012 (edited) I am trying to break 2 parallel lines and draw closing lines and intersections. I try to use getpoint to make a point somewhere at the line but it is not working. does somebody has a solution? and following insert of an object. parlinesbreak.dwg parlines.dwg Edited September 16, 2012 by s1222s Quote
giskumar Posted September 16, 2012 Posted September 16, 2012 Hi, Try this. (defun c:BRK() (setq snp (getvar "OSMODE")) (setvar "OSMODE" 0) (setq ent (entsel "\nSelect line to break")) (setq po (cadr ent)) (setq ent (car ent)) (setq vlent (vlax-ename->vla-object ent)) (setq po (vlax-curve-getclosestpointto vlent po)) (setq po1 (getpoint po "\nSelect next point to break")) (setq po1 (vlax-curve-getclosestpointto vlent po1)) (setq ent1 (car (entsel "\nSelect parallen entity"))) (setq vlent1 (vlax-ename->vla-object ent1)) (setq po2 (vlax-curve-getclosestpointto vlent1 po)) (setq po3 (vlax-curve-getclosestpointto vlent1 po1)) (command "Break" ent po po1) (command "Break" ent1 po2 po3) (command "line" po po2 "") (command "line" po1 po3 "") (setvar "OSMODE" snp) ) Quote
pBe Posted September 16, 2012 Posted September 16, 2012 Another: (defun c:br2 (/ lines pt1 pt2 ol plst) ;;; pBe Sep 2012 ;;; (vl-load-com) (prompt "\nSelect Objects to Break:") (cond ((and (setq plst nil lines (ssget ":L" '((0 . "LINE"))) ) (= (sslength lines) 2) (setq pt1 (getpoint "\nPick first point:")) (setq pt2 (getpoint pt1 "\nPick second point:")) (repeat (sslength lines) (setq ol (ssname lines 0)) (setq plst (cons (vlax-curve-getclosestpointto ol pt1) plst) plst (cons (vlax-curve-getclosestpointto ol pt2) plst) ) (command "_break" ol "_non" pt1 "_non" pt2) (ssdel ol lines) ) (mapcar '(lambda (j) (entmakex (list (cons 0 "LINE") (cons 10 (nth (Car j) plst)) (cons 11 (nth (Cadr j) plst)) ) ) ) '((0 2) (1 3)) ) ) ) ) (princ) ) HTH Quote
s1222s Posted September 16, 2012 Author Posted September 16, 2012 (edited) Thanks. Its working but not at all. That is I am trying to do: brklns.dwg Part of my code: (defun c:WR1 ( / aa b c c5 c6 c7 c8 cc3 d l la lb dr wbl) (setq bl (getvar "BLIPMODE")) (setq cm (getvar "CMDECHO")) (setvar "CMDECHO" 0) (if (not doorw) (setq doorw 0.9) ) (initget 2) (setq dr (getdist (strcat "Door with: <" (rtos doorw 2 2) ">"))) (if dr (setq doorw dr) ) ;(setq a1 (cdr (assoc 10 (entget (car (entsel)))))) (setq aobject (cdr (entget (car (entsel "\nSelect first line: "))))) (setq a1 (cdr (assoc 10 (cdr aobject)))) (setq a2 (cdr (assoc 11 (cdr aobject)))) (setq bobject (cdr (entget (car (entsel "\nSelect second line: "))))) (setq b1 (cdr (assoc 10 (cdr bobject)))) (setq b2 (cdr (assoc 11 (cdr bobject)))) (setq _c (getpoint "\nBase point: ")) (initget 1 "Left Right:") (setq d (getkword "\nLeft or Right?")) (setq _la (angle a1 a2)) (setq _lb (angle b1 b2)) (setq lac (angle a1 _c)) (setq c1 (polar a1 _la (* (cos (- _la lac)) (distance a1 _c)))) (setq cd (distance a1 b1)) (setq lbc (angle b1 (polar _c (+ _lb (* 0.5 pi)) (* (cos (- _lb lbc)) cd)))) (setq c2 (polar b1 (+ _lb (* 0.5 pi)) (* (cos (- _lb lbc)) cd))) .......................... That "_c" point is not on the place where I've picked it (base point). Edited September 16, 2012 by s1222s Quote
pBe Posted September 16, 2012 Posted September 16, 2012 (edited) With prompt for Door Width: (defun c:br2 (/ lines pt1 pt2 ol plst) ;;; pBe Sep 2012 ;;; (vl-load-com) (prompt "\nSelect Objects to Break:") (cond ((and (setq plst nil lines (ssget ":L" '((0 . "LINE"))) ) (= (sslength lines) 2) [color="blue"](setq dr (cond ((getdist (strcat "\nEnter Window width" (if dr (strcat " <" (rtos dr) ">: ") ": ") )))(dr)) )[/color] (setq pt1 (getpoint "\nPick first point:")) (setq pt2 (getpoint pt1 "\nPick second point for direction:")) [color="blue"](setq pt2 (polar pt1 (angle pt1 pt2) dr))[/color] (repeat (sslength lines) (setq ol (ssname lines 0)) (setq plst (cons (vlax-curve-getclosestpointto ol pt1) plst) plst (cons (vlax-curve-getclosestpointto ol pt2) plst) ) (command "_break" ol "_non" pt1 "_non" pt2) (ssdel ol lines) ) (mapcar '(lambda (j) (entmakex (list (cons 0 "LINE") (cons 10 (nth (Car j) plst)) (cons 11 (nth (Cadr j) plst)) ) ) ) '((0 2) (1 3)) ) ) ) ) (princ) ) BTW: Welcome to the Forum Please do read this Code Posting Guidelines Edited September 16, 2012 by pBe Quote
s1222s Posted September 16, 2012 Author Posted September 16, 2012 Great thanks. Its working. I see a lot of thinks need to be clarified in autolisp:) But with getpoint is possible to get a point because I thought it was wrong, right. Quote
pBe Posted September 16, 2012 Posted September 16, 2012 Great thanks. Its working. You are welcome, Glad to help. Hope you'll learn from it. Please update your post after reading Code Posting Guidelines Cheers Quote
s1222s Posted September 16, 2012 Author Posted September 16, 2012 Ok. Why do I really need "vlax-curve-getClosestPoint" in that lisp?! Quote
BIGAL Posted September 16, 2012 Posted September 16, 2012 Is this what your trying to do, plus lots more if so private email me the add on to do simple house designs is still avaialble can supply details Quote
s1222s Posted September 17, 2012 Author Posted September 17, 2012 Yes right that I try to do but main thing I try is to learn autolisp. stefan_ss@abv.bg Quote
s1222s Posted September 22, 2012 Author Posted September 22, 2012 Isnt it possible to be prepared this lisp without "VL" things. I dont need it and want to be made pure lisp without visual lisp and use Left or Right for direction. Quote
BIGAL Posted September 23, 2012 Posted September 23, 2012 All you have to do is use the polar command to work out the intersecting points on the other wall skins then use break and draw lines etc Always pick either inside or outside line then you know which way wall is located. The example I posted is created via all plain old fashioned lisp. But I would go down the VL way now removes lots of coding. pi3 is 270 deg door line pts b d wall w2 w3 w4 double skin wall (setq pt3 (polar b (+ pi3 (angle b d)) (+ w2 w3 w4))) Quote
s1222s Posted October 14, 2012 Author Posted October 14, 2012 sorry but what is: door line pts b d wall w2 w3 w4 double skin wall Quote
pBe Posted October 15, 2012 Posted October 15, 2012 (edited) Anybody here ordered Vanilla? (defun c:brV ( / osm d w1 w2 pt1 pt2 pt3 pt4) (setq osm (getvar 'Osmode)) (setvar 'osmode 0) (setq d (getdist "\nEnter Door width: ")) (setq w1 (entsel "\nPick one side of the wall: ") w2 (entsel "\nPick other side of the wall: ") ) (command "_line" (setq pt1 (osnap (cadr w1) "_nea")) (setq pt2 (osnap (cadr w2) "_per")) "" ) (setvar 'osmode 512) (setq dir (Getpoint pt1 "\nPick point for Direction:")) (setvar 'osmode 0) (command "_line" (setq pt3 (polar pt1 (angle pt1 dir) d)) (osnap (setq pt4 (polar pt3 (angle pt1 pt2) (distance pt1 pt2))) "_per" ) "" ) (command "_break" (car w1) pt1 pt3) (command "_break" (car w2) pt2 pt4) (setvar 'osmode osm) (princ) ) Usage: command: brv Edited October 15, 2012 by pBe Quote
BIGAL Posted October 15, 2012 Posted October 15, 2012 Must have had a brain drian when I posted above Further to PBe code you only need pick line once pick left side of door enter distance from end therefore know right side of door on line via polar then can do break. The pick point for direction is not needed as you pick door on left side of wall implying which way is say in. You get used to left and right very quick even when upside down. I would post the code but its copyrited. Quote
martinle Posted October 16, 2012 Posted October 16, 2012 Anybody here ordered Vanilla? (defun c:brV ( / osm d w1 w2 pt1 pt2 pt3 pt4) (setq osm (getvar 'Osmode)) (setvar 'osmode 0) (setq d (getdist "\nEnter Door width: ")) (setq w1 (entsel "\nPick one side of the wall: ") w2 (entsel "\nPick other side of the wall: ") ) (command "_line" (setq pt1 (osnap (cadr w1) "_nea")) (setq pt2 (osnap (cadr w2) "_per")) "" ) (setvar 'osmode 512) (setq dir (Getpoint pt1 "\nPick point for Direction:")) (setvar 'osmode 0) (command "_line" (setq pt3 (polar pt1 (angle pt1 dir) d)) (osnap (setq pt4 (polar pt3 (angle pt1 pt2) (distance pt1 pt2))) "_per" ) "" ) (command "_break" (car w1) pt1 pt3) (command "_break" (car w2) pt2 pt4) (setvar 'osmode osm) (princ) ) Usage: command: brv Hello PBE! Great Lisp. Unfortunately, I can not use an object snap. If this were possible in this Lisp or not? Best regards Martin Quote
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.