Adding Multiline Style - Cannot set color

Adding Multiline Style - Cannot set color

MarkSanchezSPEC
Advocate Advocate
1,027 Views
3 Replies
Message 1 of 4

Adding Multiline Style - Cannot set color

MarkSanchezSPEC
Advocate
Advocate

My function correctly adds a multiline style but I am having trouble setting the "Color" for the Offset elements to "ByLayer" (please see attachment). They either default to "ByBlock" or only the color of the first offset gets set (not the second one). This is the code:

 

(defun AddMlineStyle (mlsName outerGap)
    (if (not (dictadd (cdar (dictsearch (namedobjdict) "ACAD_MLINESTYLE"))
	mlsName
	    (entmakex
		(list '(0 . "MLINESTYLE")
		'(100 . "AcDbMlineStyle")
		(cons 2 mlsName)
		'(70 . 0)
		'(3 . "SPEC Pipe")
		'(62 . 256)
		'(71 . 4)
		(cons 49  outerGap)
		(cons 49  (* -1 outerGap))
	    )
	)))  
  	(princ (strcat "Mline style already exists: " mlsName))
    )
    (princ)
)

Called like this:

(AddMlineStyle "CTRAY-12" 6.0)
0 Likes
Accepted solutions (1)
1,028 Views
3 Replies
Replies (3)
Message 2 of 4

ronjonp
Mentor
Mentor
Accepted solution

Maybe this?

(defun addmlinestyle (mlsname outergap)
  (if (not (dictadd (cdar (dictsearch (namedobjdict) "ACAD_MLINESTYLE"))
		    mlsname
		    (entmakex (list '(0 . "MLINESTYLE")
				    '(100 . "AcDbMlineStyle")
				    (cons 2 mlsname)
				    '(70 . 0)
				    '(3 . "SPEC Pipe")
				    '(71 . 2)
				    (cons 49 outergap)
				    '(62 . 256)
				    (cons 49 (* -1 outergap))
				    '(62 . 256)
			      )
		    )
	   )
      )
    (princ (strcat "Mline style already exists: " mlsname))
  )
  (princ)
)
(addmlinestyle "testing" 1234)
Message 3 of 4

MarkSanchezSPEC
Advocate
Advocate

Worked perfectly, thanks!

0 Likes
Message 4 of 4

ronjonp
Mentor
Mentor

Glad to help 🙂

0 Likes