yajis_narif Posted April 28, 2011 Posted April 28, 2011 hiiii !! i need help plz and I’m sorry my English is bad so i have a drawing with 4 of the same block (i used insert) for example this is my insert : ((-1 . ) (0 . "INSERT") (330 . name: 7ef05cf8>) (5 . "22F") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "LE420") (62 . 4) (100 . "AcDbBlockReference") (2 . "drawing1") (10 21643.4 8501.78 0.0) (41 . 1.0) (42 . 1.0) (43 . 1.0) (50 . 0.0) (70 . 0) (71 . 0) (44 . 0.0) (45 . 0.0) (210 0.0 0.0 1.0)) so to get the DXF code of bloc "drawing1" i use the tblsearch : (setq y (entget (cdr ( assoc -2 (tblsearch "block" "drawing1"))))) it return the XDF code of one of the 4 block : ((-1 . ) (0 . "LWPOLYLINE") (330 . 7ef074f0>) (5 . "255") (100 . "AcDbEntity") (67 . 0) (8 . "drwing1") (62 . 4) (100 . "AcDbPolyline") (90 . 4) (70 . 1) (43 . 0.0) (38 . 0.0) (39 . 0.0) (10 210.0 210.0) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 3101.0 210.0) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 3101.0 3089.0) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 210.0 3089.0) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (210 0.0 0.0 1.0)) the problem is that i want to calculate the distance betwen the block 1 and block 2 so i need the the coordinate of the LWPOLYLINE of etch bloc Plzz can you help me ?? Thank you Quote
JohnM Posted April 28, 2011 Posted April 28, 2011 dxf code 10 has the vertex locations for the lwpolyline you can us the foreach function to pull them out Quote
yajis_narif Posted April 28, 2011 Author Posted April 28, 2011 yes i did but i just get the LWPOLYLINE coordinate of one block i don't know how to get the LWPOLYLINE coordinate of all the blocks thank you johnM Quote
JohnM Posted April 28, 2011 Posted April 28, 2011 use the ssget function with the filter to get the blocks ex: (setq ss (ssget '((0 . "INSERT") (2 . "drawing1"))))) (not tested but close) then loop througfh the selection set to pull out each polyline Quote
Lee Mac Posted April 28, 2011 Posted April 28, 2011 yajis, You will need to transform the LWPolyline in the block definiton (defined at zero rotation, 1:1 scale, in WCS) to each Insert (varied rotation, varied scale, defined in OCS of Insert). This can be achieved using a transformation matrix. Examples of performing such a transformation in a program can be found here and here. HTH Quote
yajis_narif Posted April 29, 2011 Author Posted April 29, 2011 hii thank you lee but i'm a beginner in autolisp plz can you explain more i didn't understand thank you for your help 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.