Jump to content

Recommended Posts

  • Replies 49
  • Created
  • Last Reply

Top Posters In This Topic

  • Kerry Brown

    27

  • Tharwat

    22

  • Lee Mac

    1

Top Posters In This Topic

Posted Images

Posted

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

Posted
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.

Posted

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.

Posted

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)
)

Posted

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)
)

Posted

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

Posted
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.

 

FYI, Kerry is entmake'ing an MLineStyle, not an MLine.

Posted
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.

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...