Tharwat Posted August 6, 2010 Author Posted August 6, 2010 Hello Kerry. You have done a very hard work for me, I do appreciate that so much. Most of these codes that you have given are not known to me, so I feel a little bit hard to deal with them. Thanks Quote
Kerry Brown Posted August 6, 2010 Posted August 6, 2010 With the code in post #31 We need the results of (entget (cadr (kdub:MLINESTYLE-GET "Closed") )) (entget (cadr (kdub:MLINESTYLE-GET "Opened") )) (entget (cadr (kdub:MLINESTYLE-GET "First-open") )) (entget (cadr (kdub:MLINESTYLE-GET "Last-open") )) so I know how you want the styles defined { using entmake }. Just load the code in Post #31 http://www.cadtutor.net/forum/showthread.php?51057-Set-a-specific-MLine-Style-on&p=346817&viewfull=1#post346817 and then run these and post the results. I may be able to help you while you study the code. Quote
Tharwat Posted August 6, 2010 Author Posted August 6, 2010 Here they are .... First. Command:[b] (entget (cadr (kdub:MLINESTYLE-GET "Closed") ))[/b] ((-1 . <Entity name: 7ee04600>) (0 . "MLINESTYLE") (5 . "1B0") (102 . "{ACAD_REACTORS") (330 . <Entity name: 7ee02cb8>) (102 . "}") (330 . <Entity name: 7ee02cb8>) (100 . "AcDbMlineStyle") (2 . "CLOSED") (70 . 272) (3 . "") (62 . 256) (51 . 1.5708) (52 . 1.5708) (71 . 2) (49 . 0.5) (62 . 256) (6 . "BYLAYER") (49 . -0.5) (62 . 256) (6 . "BYLAYER")) Second. Command: (entget (cadr (kdub:MLINESTYLE-GET "Opened") )) ((-1 . <Entity name: 7ee04608>) (0 . "MLINESTYLE") (5 . "1B1") (102 . "{ACAD_REACTORS") (330 . <Entity name: 7ee02cb8>) (102 . "}") (330 . <Entity name: 7ee02cb8>) (100 . "AcDbMlineStyle") (2 . "OPENED") (70 . 0) (3 . "") (62 . 256) (51 . 1.5708) (52 . 1.5708) (71 . 2) (49 . 0.5) (62 . 256) (6 . "BYLAYER") (49 . -0.5) (62 . 256) (6 . "BYLAYER")) Third. Command: (entget (cadr (kdub:MLINESTYLE-GET "First-open") )) ((-1 . <Entity name: 7ee04620>) (0 . "MLINESTYLE") (5 . "1B4") (102 . "{ACAD_REACTORS") (330 . <Entity name: 7ee02cb8>) (102 . "}") (330 . <Entity name: 7ee02cb8>) (100 . "AcDbMlineStyle") (2 . "FIRST-OPEN") (70 . 256) (3 . "") (62 . 256) (51 . 1.5708) (52 . 1.5708) (71 . 2) (49 . 0.5) (62 . 256) (6 . "BYLAYER") (49 . -0.5) (62 . 256) (6 . "BYLAYER")) Forth. Command: (entget (cadr (kdub:MLINESTYLE-GET "Last-open") )) ((-1 . <Entity name: 7ee04628>) (0 . "MLINESTYLE") (5 . "1B5") (102 . "{ACAD_REACTORS") (330 . <Entity name: 7ee02cb8>) (102 . "}") (330 . <Entity name: 7ee02cb8>) (100 . "AcDbMlineStyle") (2 . "LAST-OPEN") (70 . 16) (3 . "") (62 . 256) (51 . 1.5708) (52 . 1.5708) (71 . 2) (49 . 0.5) (62 . 256) (6 . "BYLAYER") (49 . -0.5) (62 . 256) (6 . "BYLAYER")) Regards. Quote
Tharwat Posted August 6, 2010 Author Posted August 6, 2010 Here is the correct Lisp that it was written wrong by me before with (if ..... T). (defun c:du (/ curlay width style) (setq curlay (getvar "clayer")) (if (not (tblsearch "layer" "ACDUCT")) (command "._-layer" "_make" "ACDUCT" "_ltype" "continuous" "" "_color" "142" "" "") (setvar 'clayer "acduct") ) (setq width (getint "\nSpecify width of Duct: ")) (initget "Closed Opened First-open Last-open") (if(setq sty (getkword "\nSpecify the MLineSty [Closed Opened First-open Last-open]:")) (setvar 'cmlstyle sty) (progn (alert "The chosen MLStyle is not avaliable") (exit))) (command "_mline" "_J" "_z" "_scale" width) (command pause) (setvar "clayer" curlay) (princ) ) Quote
Kerry Brown Posted August 6, 2010 Posted August 6, 2010 Have a play with these : ;;-------------------------------------------------------------------------------- (defun c:du (/ curlay width sty) (kdub:AssertMultiLineStyleDefinitionsExist) (setq curlay (getvar "clayer")) (if (not (tblsearch "layer" "ACDUCT")) (command "._-layer" "_make" "ACDUCT" "_ltype" "continuous" "" "_color" "142" "" "") (setvar 'clayer "acduct") ) ;;----------------------------------- (setq width (getdist "\nSpecify width of Duct: ")) (initget 1 "Closed Opened First-open Last-open") (if (and (setq sty (getkword "\nSpecify the MLineStyle [Closed Opened First-open Last-open]:")) (Kdub:Mlinestyle-Get sty) ) (setvar 'cmlstyle sty) (progn (alert "The chosen MLStyle is not avaliable") (exit)) ) ;;----------------------------------- (command "_mline" "_J" "_z" "_scale" width "") (command "_mline") (setvar "clayer" curlay) (princ) ) ;;-------------------------------------------------------------------------------- ** Library stuff ** ;;-------------------------------------------------------------------------------- (defun Kdub:Mlinestyle-Get (Name / mlsty-DICT MLSty) (if (setq mlsty-DICT (dictsearch (Namedobjdict) "ACAD_MLINESTYLE")) (while (and mlsty-DICT (not (setq MLSty (if (and (assoc 3 mlsty-DICT) (= (strcase (cdr (assoc 3 mlsty-DICT))) (strcase Name))) (list (strcase Name) (cdr (cadr (member (assoc 3 mlsty-DICT) mlsty-DICT)))) ) ) ) ) (setq mlsty-DICT (cdr (member (assoc 3 mlsty-DICT) mlsty-DICT))) ) ) MLSty ) ;;-------------------------------------------------------------------------------- (defun massoc (key alist / x nlist) (foreach x alist (if (eq key (car x)) (setq nlist (cons (cdr x) nlist)) ) ) (reverse nlist) ) ;;-------------------------------------------------------------------------------- ;;-------------------------------------------------------------------------------- (defun kdub:AssertMultiLineStyleDefinitionsExist (/ mlSty-DICT MultiLineStyle_lst StyleName) ;; kdub 20100807 ;; Ensure definition of AcDbMlineStyles ;; Closed Opened First-open Last-open ;;----------------------------------- ;;----------------------------------- (setq mlSty-DICT-ent (cdr (cadr (member '(3 . "ACAD_MLINESTYLE") (entget (namedobjdict))))) MultiLineStyle_lst (mapcar 'STRCASE (massoc 3 (entget mlSty-DICT-ent))) ) ;| dxf 70 Flags (bit-coded): 1 =Fill on 2 = Display miters 16 = Start square end (line) cap 32 = Start inner arcs cap 64 = Start round (outer arcs) cap 256 = End square (line) cap 512 = End inner arcs cap 1024 = End round (outer arcs) cap |;;;----------------------------------- (setq StyleName "Closed") (if (not (member (strcase StyleName) MultiLineStyle_lst)) (dictadd mlSty-DICT-ent StyleName (entmakex (list '(0 . "MLINESTYLE") '(100 . "AcDbMlineStyle") (cons 2 StyleName) '(70 . 272) ; End flag '(3 . "") ; StyleDescription '(62 . 256) ; fill color '(51 . 1.5708) ; start angle '(52 . 1.5708) ; end angle '(71 . 2) ; qty elements ; '(49 . 0.5) ; element offset '(62 . 256) '(6 . "BYLAYER") ; Element Linetype '(49 . -0.5) '(62 . 256) '(6 . "BYLAYER") ) ) ) ) ;;----------------------------------- (setq StyleName "Opened") (if (not (member (strcase StyleName) MultiLineStyle_lst)) (dictadd mlSty-DICT-ent StyleName (entmakex (list '(0 . "MLINESTYLE") '(100 . "AcDbMlineStyle") (cons 2 StyleName) '(70 . 0) ; End flag '(3 . "") ; StyleDescription '(62 . 256) ; fill color '(51 . 1.5708) ; start angle '(52 . 1.5708) ; end angle '(71 . 2) ; qty elements ; '(49 . 0.5) ; element offset '(62 . 256) '(6 . "BYLAYER") ; Element Linetype '(49 . -0.5) '(62 . 256) '(6 . "BYLAYER") ) ) ) ) ;;----------------------------------- (setq StyleName "First-open") (if (not (member (strcase StyleName) MultiLineStyle_lst)) (dictadd mlSty-DICT-ent StyleName (entmakex (list '(0 . "MLINESTYLE") '(100 . "AcDbMlineStyle") (cons 2 StyleName) '(70 . 256) ; End flag '(3 . "") ; StyleDescription '(62 . 256) ; fill color '(51 . 1.5708) ; start angle '(52 . 1.5708) ; end angle '(71 . 2) ; qty elements ; '(49 . 0.5) ; element offset '(62 . 256) '(6 . "BYLAYER") ; Element Linetype '(49 . -0.5) '(62 . 256) '(6 . "BYLAYER") ) ) ) ) ;;----------------------------------- (setq StyleName "Last-open") (if (not (member (strcase StyleName) MultiLineStyle_lst)) (dictadd mlSty-DICT-ent StyleName (entmakex (list '(0 . "MLINESTYLE") '(100 . "AcDbMlineStyle") (cons 2 StyleName) '(70 . 16) ; End flag '(3 . "") ; StyleDescription '(62 . 256) ; fill color '(51 . 1.5708) ; start angle '(52 . 1.5708) ; end angle '(71 . 2) ; qty elements ; '(49 . 0.5) ; element offset '(62 . 256) '(6 . "BYLAYER") ; Element Linetype '(49 . -0.5) '(62 . 256) '(6 . "BYLAYER") ) ) ) ) ;;----------------------------------- (princ) ) Quote
Tharwat Posted August 7, 2010 Author Posted August 7, 2010 That's Amazing and greatly complete work Mr. Kerry You did a routine that most of experts couldn't do, all of them saying that it couldn't be made that way special the ( entmakex Mline ) which is could be trouble maker and may hang up from time to time. Thank you so much. your major help is greatly appreciated. Tharwat Quote
Lee Mac Posted August 7, 2010 Posted August 7, 2010 You did a routine that most of experts couldn't do, all of them saying that it couldn't bemade that way special the ( entmakex Mline ) which is could be trouble maker and may hang up from time to time. FYI, Kerry is entmake'ing an MLineStyle, not an MLine. Quote
Tharwat Posted August 7, 2010 Author Posted August 7, 2010 FYI, Kerry is entmake'ing an MLineStyle, not an MLine. I don't know what do you expect from me after that. But my honesty says thank's for paying attention to it. 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.