Bob658 Posted October 30, 2019 Posted October 30, 2019 I have a series of blocks which are being used multiple times in a model. All of the blocks have a polyline within them on the same layer. Is there anyway I can extract the co-ordinates of those polylines? Quote
CyberAngel Posted October 30, 2019 Posted October 30, 2019 If the data is in the drawing, you can always get it out. The question is how. Pick a programming language you're comfortable with, and you should be able to extract at least the insertion point of the blocks. To help you any better, we'd probably need more information. Do these blocks appear with multiple scales and rotations? Do you need the starting vertex or all of them? Where will the data go, and how should it be formatted? Quote
tombu Posted October 30, 2019 Posted October 30, 2019 The Express Tool ncopy copies objects nested inside blocks and external references. Might be a starting point. Quote
Bob658 Posted October 30, 2019 Author Posted October 30, 2019 I've attached an example file that contains the blocks. Within the blocks there are polylines on the layer B_Footprint. What I'd like to do is extract the co-ordinates of the polylines either into a table or a excel sheet or word file. I don't mind which. However they are dynamic blocks and I only want the ones that are visible. Drawing3.dwg Quote
BIGAL Posted October 31, 2019 Posted October 31, 2019 (edited) A quick and dirty, copy the block a known amount say +x direction. get bounding box of copy, explode block, use ssget with pline and correct layer then get co-ords subtract -x from all co-ords erase copy. Do what ever next with co-ord. For others the code will fail if you can not "SEE" the copied block. This is one of those Gotcha lisp problems. (defun c:test ( / pt1 pt2 ss x k j pt plent) (setq ent (entsel "select block")) (setq xoff 250.0) (command "copy" ent "" "0,0" (list xoff 0.0)) (setq obj (vlax-ename->vla-object (entlast))) (vla-GetBoundingBox obj 'minpoint 'maxpoint) (setq pointmin (vlax-safearray->list minpoint)) (setq pointmax (vlax-safearray->list maxpoint)) (command "explode" (entlast) ) (command "zoom" "C" pointmin 80.0) (setq ss (ssget "w" pointmin pointmax (list (cons 0 "lwpolyline")(cons 8 "B-Footprint")))) (setq plent (ssname ss 0)) (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (j) (= (car j) 10)) (entget plent)))) (setq lst2 '()) (repeat (setq k (length co-ord)) (setq pt (nth (setq k (- k 1)) co-ord)) (setq x (- (car pt) xoff)) (setq lst2 (cons (list x (cadr pt)) lst2)) ) (command "erase" "w" pointmin pointmax "") (command "zoom" "P") (alert "points are in lst2") (princ lst2) ) Edited October 31, 2019 by BIGAL Quote
SLW210 Posted October 31, 2019 Posted October 31, 2019 I have moved your thread to the AutoLISP, Visual LISP & DCL Forum. Quote
Lee Mac Posted October 31, 2019 Posted October 31, 2019 (edited) On 10/30/2019 at 12:15 PM, Bob658 said: I have a series of blocks which are being used multiple times in a model. All of the blocks have a polyline within them on the same layer. Is there anyway I can extract the co-ordinates of those polylines? A similar question was recently asked (and answered) in this thread. Edited October 31, 2019 by Lee Mac Quote
BIGAL Posted October 31, 2019 Posted October 31, 2019 Hi Lee that is the right way to do it, as I said the quick and dirty way. 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.