Jump to content

layer type with numbers on it


egilim123

Recommended Posts

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 by mhupp
Link to comment
Share on other sites

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

  • Like 1
Link to comment
Share on other sites

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 by mhupp
  • Like 1
Link to comment
Share on other sites

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

  • Agree 1
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...