ajs Posted May 24, 2009 Share Posted May 24, 2009 Odd one here: I have dxf drawings that are exported by a 3rd party program which to the best of my understanding is using a pre-R14 protocal. When the drawings are exported, all the layer information is lost. The only way to determine which entities belong on which layers is by line thicknesses. Here's my problem: When the line thicknesses fall below a certain threshhold, my selection set(s) will no longer recognize the thickness. Here's an example where the selection set recognizes a line thickness of 0.5: First, I'll doublecheck on the line thickness (In red): Command : (setq en(car (entsel "\n Select a Line: "))) Select a Line: Command : (setq enlist(entget en)) ((-1 . ) (0 . "LINE") (5 . "19CD") (67 . 0) (8 . "0") (410 . "Model") (62 . 256) (6 . "ByLayer") (370 . -1) (347 . ) (284 . 0) (48 . 1.00000) (60 . 0) (39 . 0.500000) (10 -60.6955 -232.224 0.000000) (11 224.744 -84.3548 0.000000) (210 0.000000 0.000000 1.00000)) Now, here's the successful selection set: Command : (setq ID_2(ssget "x" (list (cons 39 0.5)))) Ok. now I'm going to search for a smaller thickness; 0.04 Again, I'll doublecheck: Command : (setq en(car (entsel "\n Select a Line: "))) Select a Line: Command : (setq enlist(entget en)) ((-1 . ) (0 . "LINE") (5 . "19CD") (67 . 0) (8 . "0") (410 . "Model") (62 . 256) (6 . "ByLayer") (370 . -1) (347 . ) (284 . 0) (48 . 1.00000) (60 . 0) (39 . 0.0400000) (10 -60.6955 -232.224 0.000000) (11 224.744 -84.3548 0.000000) (210 0.000000 0.000000 1.00000)) However, now when I run a selection set based on a thickness value of 0.0400, I get a nill: Command : (setq ID_2(ssget "x" (list (cons 39 0.0400)))) nil Huh ??? The only thing that I can think of is that there is some threshold below which the line thickness is not recognized. Unfortunately, the 3rd party program that exports these line thicknesses in values that are less than 0.1. This value is not editable. Now, the line thicknesses are irrelevant to me; once I figure out how to run the selection set, I'm going to set the line thickness to zero and use line widths instead. So what I was wondering was if it was possible to do some kind of global command to scale all the existing line weights up to the point where they are recognized. I've been playing around with this but I haven't been able to figure out how to do it. Any help for this stumped individual would be greatly appreciated. AJS Quote Link to comment Share on other sites More sharing options...
ajs Posted May 24, 2009 Author Share Posted May 24, 2009 I was able to get this worked out with the (always dead on) help of Jeffrey P Sanders: http://www.jefferypsanders.com/autolisp.html Here's the scaling lisp: ;;;--- Scale Line thickness (defun C:SLTHK() (setq sf(getreal "\nScale Factor: ")) ;;;--- Scale the lines (if(setq eset(ssget "X" (list (cons 0 "LINE")))) (progn (setq cntr 0) (while( (setq en(ssname eset cntr)) (setq enlist(entget en)) (if(assoc 39 enlist) (progn (setq oldSF(cdr(assoc 39 enlist))) (setq newSF(* oldSF sf)) (setq enlist(subst (cons 39 newSF)(assoc 39 enlist)enlist)) (entmod enlist) (entupd en) (setq cntr(+ cntr 1)) ) ) ) (princ "\n Scaled ")(princ cntr)(princ " Line thicknesses.") ) ) ;;;--- Scale the lwpolylines (if(setq eset(ssget "X" (list (cons 0 "LWPOLYLINE")))) (progn (setq cntr 0) (while( (setq en(ssname eset cntr)) (setq enlist(entget en)) (if(assoc 39 enlist) (progn (setq oldSF(cdr(assoc 39 enlist))) (setq newSF(* oldSF sf)) (setq enlist(subst (cons 39 newSF)(assoc 39 enlist)enlist)) (entmod enlist) (entupd en) (setq cntr(+ cntr 1)) ) ) ) (princ "\n Scaled ")(princ cntr)(princ " LWPolyline thicknesses.") ) ) ;;;--- Scale the polylines (if(setq eset(ssget "X" (list (cons 0 "POLYLINE")))) (progn (setq cntr 0) (while( (setq en(ssname eset cntr)) (setq enlist(entget en)) (if(assoc 39 enlist) (progn (setq oldSF(cdr(assoc 39 enlist))) (setq newSF(* oldSF sf)) (setq enlist(subst (cons 39 newSF)(assoc 39 enlist)enlist)) (entmod enlist) (entupd en) (setq cntr(+ cntr 1)) ) ) ) (princ "\n Scaled ")(princ cntr)(princ " Polyline thicknesses.") ) ) (princ) ) Thanks to all who took a look at this. AJS Quote Link to comment Share on other sites More sharing options...
JohnM Posted May 24, 2009 Share Posted May 24, 2009 try bringing up the properties dialog box then window select everything use the properties drop down window and select line or polyline then ajust the line value below or look into using the quick select button on the properties box once you understand it you will get quick at global changes Quote Link to comment Share on other sites More sharing options...
ajs Posted May 25, 2009 Author Share Posted May 25, 2009 Thanks for your feedback. If I'm understanding you correctly, you're suggesting a manual change via the properties dialog box. For this application, a manual change is not practical as this is an "assembly line" affair with app. 60 drawings at a time. The line thickness scaling process does appear to work. The only adjustment I had to make was to apply a rounding function so that the scaled thicknesses rounded to the nearest 0.5 which so far has been 100 percent reliable in terms of selection sets. I'm speculating that perhaps the smaller numbers cause problems due to precision variations. Thank you all for your generous help; Cadtutor has been invaluable to me... AJS Quote Link to comment Share on other sites More sharing options...
CAB Posted May 26, 2009 Share Posted May 26, 2009 You can give this a try. Should get any LWpline with a thickness > zero AND (setq sset (ssget "X" '((0 . "LWPOLYLINE")(-4 . ">")(39 . 0.0)(-4 . "<=")(39 . 0.4)))) Quote Link to comment Share on other sites More sharing options...
ajs Posted May 28, 2009 Author Share Posted May 28, 2009 Thank you; that worked as well AJS 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.