minhphuong_humg Posted November 21, 2015 Share Posted November 21, 2015 Hi, everybody. I draw a polyline, on which are the any blocks with the blocks (Case 1) or different line, polyline, xline (Case 2)..... Please help me a lisp Auto dimension as file attach. Thank you very much! File: Autodimension.dwg Quote Link to comment Share on other sites More sharing options...
BIGAL Posted November 23, 2015 Share Posted November 23, 2015 The simple answer is in using ssget "F" this creates a list of objects crossing a pline then a intersect with the obvious way is to do it for block insert pt, circle, line/pline crossing. Some one your welcome to jump in I need to paste together 3 programs will take time. Quote Link to comment Share on other sites More sharing options...
minhphuong_humg Posted November 23, 2015 Author Share Posted November 23, 2015 The simple answer is in using ssget "F" this creates a list of objects crossing a pline then a intersect with the obvious way is to do it for block insert pt, circle, line/pline crossing. Some one your welcome to jump in I need to paste together 3 programs will take time. Thank BIGAL very much! Very happy to get help from BIGAL. I do not know how to write lisp need your help is very good. Please help me, thank BIGAL again. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted November 24, 2015 Share Posted November 24, 2015 Bit busy right now any one else ? Quote Link to comment Share on other sites More sharing options...
minhphuong_humg Posted November 24, 2015 Author Share Posted November 24, 2015 Bit busy right now any one else ? Thank BIGAL very much! Hope someone help me! Thank for all. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted November 25, 2015 Share Posted November 25, 2015 here is a start use the simple test of divide a pline and creating points along it and return the co-ords of the points. Use multiple if's or a COND would be neater ; 1st step to find objects along a pline ; by Alan H (defun pointpline ( / ss x obj pt co-ordsxy) (if (not co-ords2xy) (load "pline co-ords")) (setq co-ords (getcoords (car (entsel "\nplease pick pline")))) (co-ords2xy) (setq ss (ssget "F" co-ordsxy)) (setq x (sslength ss)) (repeat (sslength ss) (setq obj (vlax-ename->vla-object (ssname SS (setq x (- x 1))))) (if (= "AcDbPoint" (vla-get-objectname obj)) (setq pt (vlax-safearray->list (vlax-variant-value (vla-get-Coordinates obj)))) ) (princ pt) ) ) (pointpline) and you will need this ; pline co-ords example ; by Alan H (defun getcoords (ent) (vlax-safearray->list (vlax-variant-value (vlax-get-property (vlax-ename->vla-object ent) "Coordinates" ) ) ) ) (defun co-ords2xy () ; convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z (setq numb (/ (length co-ords) 2)) (setq I 0) (repeat numb (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) )) (setq co-ordsxy (cons xy co-ordsxy)) (setq I (+ I 2)) ) ) ; program starts here ;(setq co-ords (getcoords (car (entsel "\nplease pick pline")))) ;(co-ords2xy) Quote Link to comment Share on other sites More sharing options...
minhphuong_humg Posted November 25, 2015 Author Share Posted November 25, 2015 here is a start use the simple test of divide a pline and creating points along it and return the co-ords of the points. Use multiple if's or a COND would be neater ; 1st step to find objects along a pline ; by Alan H (defun pointpline ( / ss x obj pt co-ordsxy) (if (not co-ords2xy) (load "pline co-ords")) (setq co-ords (getcoords (car (entsel "\nplease pick pline")))) (co-ords2xy) (setq ss (ssget "F" co-ordsxy)) (setq x (sslength ss)) (repeat (sslength ss) (setq obj (vlax-ename->vla-object (ssname SS (setq x (- x 1))))) (if (= "AcDbPoint" (vla-get-objectname obj)) (setq pt (vlax-safearray->list (vlax-variant-value (vla-get-Coordinates obj)))) ) (princ pt) ) ) (pointpline) and you will need this ; pline co-ords example ; by Alan H (defun getcoords (ent) (vlax-safearray->list (vlax-variant-value (vlax-get-property (vlax-ename->vla-object ent) "Coordinates" ) ) ) ) (defun co-ords2xy () ; convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z (setq numb (/ (length co-ords) 2)) (setq I 0) (repeat numb (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) )) (setq co-ordsxy (cons xy co-ordsxy)) (setq I (+ I 2)) ) ) ; program starts here ;(setq co-ords (getcoords (car (entsel "\nplease pick pline")))) ;(co-ords2xy) Thank BIGAL very much! Thank for help me. I in turn run two lisp (getcoords.lsp and pointpline.lsp_I copy and save as to lisp). But didn't result (result: please pick plinenilnilnilnilnilnilnil). Didn't know i was wrong anywhere. Please, help me. Thank you very much! Good luck for you! getcoords.lsp pointpline.lsp Quote Link to comment Share on other sites More sharing options...
BIGAL Posted November 26, 2015 Share Posted November 26, 2015 The example was for testing, draw a Pline, then DIVIDE 10, then DDPTYE pick a shape then run program. The 10 co-ords should appear on the screen the next step would be to add blocks and finally add the Intersectwith for crossing objects. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted November 26, 2015 Share Posted November 26, 2015 Code for a block (if (= "AcDbBlockReference" (vla-get-objectname obj)) (setq pt (vlax-safearray->list (vlax-variant-value (vla-get-InsertionPoint obj)))) ) 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.