samifox Posted June 10, 2013 Share Posted June 10, 2013 Hi i wanna write code to do things based on 2 opposite (rectangular) vertices along a polyline. if you see the attach image , i want to isolate vertex 1 and 10, what is the common definition both vertices has? Thanks Shay Quote Link to comment Share on other sites More sharing options...
pBe Posted June 12, 2013 Share Posted June 12, 2013 1 and 10 are located on a polyline vertex whilst 100 and 101 falls on a polyline segment Out of curiosity and because you ask for it. (defun c:showme (/ pl pts@vertex pts plpts i ip) (setq pl (car (entsel "\nSelect Polyline:"))) (princ "\nSelect point entities") (setq pts@vertex (ssadd) pts (ssget '((0 . "POINT")))) (setq plpts (mapcar 'cdr (vl-remove-if-not '(lambda (o) (= (Car o) 10)) (entget pl)))) (repeat (setq i (sslength pts)) (setq ip (cdr (assoc 10 (entget (setq e (ssname pts (Setq i (1- i))))))) ip (list (car ip) (cadr ip))) (if (vl-some '(lambda (p) (if (and (equal (Car p) (car ip)) (equal (Cadr p) (cadr ip))) p)) plpts) (ssadd e pts@vertex))) (sssetfirst nil pts@vertex) (princ) ) Quote Link to comment Share on other sites More sharing options...
samifox Posted June 16, 2013 Author Share Posted June 16, 2013 Hello I think I misled you pbe. I meant that I want to select a poly and have those hidden vertices defined automataly. It's all for creating re . Is there any way to determine those vertices without selecting points? Sorry Shay Quote Link to comment Share on other sites More sharing options...
LibertyOne Posted June 17, 2013 Share Posted June 17, 2013 For rebar drawings, there are many steps to go through in creating a drawing. Here, like in your other post, you are starting with a wall section. I would personally start with all geometry of the concrete form. For walls you need an elevation for each wall segment. The elevation allows you to show the position and spacing of the rebar. A section only shows the form. Quote Link to comment Share on other sites More sharing options...
samifox Posted June 25, 2013 Author Share Posted June 25, 2013 I more than happy to announce that the code was written entirely by me this time, thanks to all the greater coders here. The code find what I called “square root pairs” , it meant to find columns in a structure as a basis for further structural elements placing. The code scan vertices of all selected polylines and append them into one long list , and then compare each vertex to the rest in order to find a pair (in other word, isolating them). this pair is capable to build a square A pair-able vertex is : 1. Not the same coordinate 2. Far away but not more than 58 units (diagonal distance of 40cm x 40cm) 3. A point that form a degree other than orthographic one I mange to find pairs based on those condition but the way to go is long. I know I wrote it in a long way and lots of issues never take care of. Ill be happy to get some insight on how to make it shorter, more efficient and error safe. (Dedicated to you pBe ) (defun C:DEMO (/ pl pts sspl tpts i ptlist) (setvar 'pdmode 34) (setvar 'cmdecho 0) (if (setq sspl (ssget '((0 . "LWPOLYLINE")))) (progn (setq i 0) (while (< i (sslength sspl)) (setq pts (mapcar 'cdr (vl-remove-if-not '(lambda (e) (= (Car e) 10)) (entget (ssname sspl i)) ) ) ) (setq i (1+ i)) (setq tpts (cons pts tpts)) ) ) ) (setq tpts (apply 'append tpts)) (setq ln (findPairs tpts 58 3)) ;;; (command "LINE" (nth 0 ln) (nth 1 ln) ) (princ) ) (defun findPairs(lst dis ang / ma fe pair) (setq fe 0 ma 0) (while (< ma (length lst)) (while (< fe (length lst)) (if (not(equal (nth ma lst) (nth fe lst))) (if (< (fix(distance (nth ma lst) (nth fe lst))) dis) (if (or (and (> (angle (nth ma lst) (nth fe lst)) 0.2) (< (angle (nth ma lst) (nth fe lst)) 1.4)) (and (> (angle (nth ma lst) (nth fe lst)) 1.7) (< (angle (nth ma lst) (nth fe lst)) 3.0)) (and (> (angle (nth ma lst) (nth fe lst)) 3.3) (< (angle (nth ma lst) (nth fe lst)) 4.5)) (and (> (angle (nth ma lst) (nth fe lst)) 4.9) (< (angle (nth ma lst) (nth fe lst)) 6.1)) ) (progn (setq pair (list (nth ma lst) (nth fe lst))) (command "_point" "_non" (nth ma lst) (nth fe lst) )) (princ "\nAngle ignored")) (princ "\nDistance ignored")) (princ "\nEquality ign ored")) (setq fe (1+ fe)) );_while (<fe (setq ma (1+ ma)) (setq fe 0) );_while (ma );_defun Thanks Shay 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.