egilim123 Posted November 21, 2022 Share Posted November 21, 2022 Hİ , i have layers as 20 and 40 in the attached dwg, but i need more as 50,63,75,80,100 etc. how can i do this? Drawing7.dwg Quote Link to comment Share on other sites More sharing options...
mhupp Posted November 21, 2022 Share Posted November 21, 2022 (edited) Depending on what you want modify the dxf codes http://docs.autodesk.com/ACD/2011/ENU/filesDXF/WS1a9193826455f5ff18cb41610ec0a2e719-7a51.htm (defun C:make-layers (/ lay) (setq lay '("20mm" "40mm" "50mm" "63mm" "75mm" "80mm" "100mm")) (foreach layername lay (entmake (list '(0 . "LAYER") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLayerTableRecord") (cons 2 layername) '(70 . 0) '(62 . 1))) ) ) if each layer needs diffrent properties like color (62) or freeze/lock (70) you have to make each line instead of using foreach (entmake '((0 . "LAYER") (100 . "AcDbSymbolTableRecord") (100 . "AcDbLayerTableRecord") (2 . "75mm") (70 . 0) (62 . 52))) (entmake '((0 . "LAYER") (100 . "AcDbSymbolTableRecord") (100 . "AcDbLayerTableRecord") (2 . "80mm") (70 . 0) (62 . 7))) (entmake '((0 . "LAYER") (100 . "AcDbSymbolTableRecord") (100 . "AcDbLayerTableRecord") (2 . "100mm") (70 . 0) (62 . 1))) Edited November 21, 2022 by mhupp Quote Link to comment Share on other sites More sharing options...
Steven P Posted November 21, 2022 Share Posted November 21, 2022 Could do a list of lists and then the foreach ? ;;Codes: 2, 70, 62) (setq lay (list '("20mm" 0 52) '("40mm" 0 1) '("50mm" 0 2) '("63mm" 0 256) ...... )) ; end list (foreach layername lay (entmake (list '(0 . "LAYER") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLayerTableRecord") (cons 2 (nth 0 layername)) (cons 70 (nth 1 layername)) (cons 62 (nth 2 layername)) )) ; end entmake ) ; end for each off the top of my head as an example - might be typos - the best method might depend how many layers you are making and attributes to be set in each layer 1 Quote Link to comment Share on other sites More sharing options...
mhupp Posted November 21, 2022 Share Posted November 21, 2022 (edited) Nice one Steven was almost there but then fell short! Id use car cadr caddr. found that nth is a bit slower (milliseconds). https://www.theswamp.org/index.php?PHPSESSID=356fa17355692a80576aa70cd5845024&topic=57519.msg609731#msg609731 (foreach layer lay (entmake (list '(0 . "LAYER") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLayerTableRecord") (cons 2 (car layer)) (cons 70 (cadr layer)) (cons 62 (caddr layer)) )) ; end entmake ) ; end for eac Edited November 21, 2022 by mhupp 1 Quote Link to comment Share on other sites More sharing options...
guran Posted November 21, 2022 Share Posted November 21, 2022 Try this one by Ron Perez. Linetype.lsp 1 Quote Link to comment Share on other sites More sharing options...
ronjonp Posted November 21, 2022 Share Posted November 21, 2022 40 minutes ago, guran said: Try this one by Ron Perez. Linetype.lsp 2.72 kB · 2 downloads HERE is the lastest version of that. Many more options 2 Quote Link to comment Share on other sites More sharing options...
Steven P Posted November 21, 2022 Share Posted November 21, 2022 1 hour ago, mhupp said: Nice one Steven was almost there but then fell short! Id use car cadr caddr. found that nth is a bit slower (milliseconds). That's true, I was going to use car, cadr.. decided to go nth because I reckon if you are learning from this nth is a little more obvious what it's doing - if you can understand that the first list item is number 0. Looking at Guran and RonJon, was the OP asking to create line types or layers using that line type, or both? I am not sure now 1 Quote Link to comment Share on other sites More sharing options...
egilim123 Posted November 22, 2022 Author Share Posted November 22, 2022 thanks all very much 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.