Jump to content

each matchprop


exceed

Recommended Posts

; each matchprop - text to text, ~line to ~line, hatch to hatch. - 2022.03.08 exceed
; command : mma
; Note - If you select multiple original object, the first in the selection set will be selected.

(vl-load-com)

(defun c:mma ( / *error* ss_o ss_o_t ss_o_l ss_o_h ss_o_t_1 ss_o_l_1 ss_o_h_1 ss_t ss_t_t ss_t_l ss_t_h)
  (setvar 'cmdecho 0)
  (LM:startundo (LM:acdoc))
  ;error control
    (defun *error* ( msg )
        (LM:endundo (LM:acdoc))
        (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
            (princ (strcat "\n Error: " msg))
        )
        (setvar 'cmdecho 1)
        (princ)
    )

  (princ "\n each matchprop - text to text, ~line to ~line, hatch to hatch.\n select original object :")
  (setq ss_o (ssget))
    (if (/= ss_o nil)
     (progn
       (setq ss_o_t (ssget "P" (list (cons 0 "*TEXT"))))
          (if (/= ss_o_t nil)
             (setq ss_o_t_1 (ssname ss_o_t 0))
          )
       (command "_.select" ss_o "")
       (setq ss_o_l (ssget "P" (list (cons 0 "*LINE"))))
          (if (/= ss_o_l nil)
             (setq ss_o_l_1 (ssname ss_o_l 0))
          )
       (command "_.select" ss_o "")
       (setq ss_o_h (ssget "P" (list (cons 0 "HATCH"))))
          (if (/= ss_o_h nil)
             (setq ss_o_h_1 (ssname ss_o_h 0))
          )
      );end of progn
    );end of if     

  (princ "\n select target object :")
  (setq ss_t (ssget))
    (if (and (/= ss_t nil) (/= ss_o nil))
      (progn 
        (setq ss_t_t (ssget "P" (list (cons 0 "*TEXT"))))
          (if (and (/= ss_t_t nil) (/= ss_o_t nil))
            (progn
             (command "_.matchprop" ss_o_t_1 ss_t_t "")
            );end of progn
          );end of if
        (command "_.select" ss_t "")
        (setq ss_t_h (ssget "P" (list (cons 0 "HATCH"))))
          (if (and (/= ss_t_h nil) (/= ss_o_h nil))
            (progn
             (command "_.matchprop" ss_o_h_1 ss_t_h "")
            );end of progn
          );end of if
        (command "_.select" ss_t "")
        (setq ss_t_l (ssget "P" '( (-4 . "<NOT") (-4 . "<OR") (0 . "*TEXT") (0 . "HATCH") (-4 . "OR>") (-4 . "NOT>"))))
          (if (and (/= ss_t_l nil) (/= ss_o_l nil))
            (progn 
              (command "_.matchprop" ss_o_l_1 ss_t_l "")
            )
          );end of if
        ;(command "_.select" ss_t "")
        ;(setq ss_t_l (ssget "P" (list (cons 0 "*LINE,SOLID"))))
        ;  (if (/= ss_t_l nil)
        ;    (command "_.matchprop" ss_o_l_1 ss_t_l "")
        ;  )
       );end of progn
     );end of if
  (setvar 'cmdecho 1)
  (LM:endundo (LM:acdoc))
  (princ)
)





;; Active Document  -  Lee Mac
;; Returns the VLA Active Document Object

(defun LM:acdoc nil
    (eval (list 'defun 'LM:acdoc 'nil (vla-get-activedocument (vlax-get-acad-object))))
    (LM:acdoc)
)

;; Start Undo  -  Lee Mac
;; Opens an Undo Group.

(defun LM:startundo ( doc )
    (LM:endundo doc)
    (vla-startundomark doc)
)

;; End Undo  -  Lee Mac
;; Closes an Undo Group.

(defun LM:endundo ( doc )
    (while (= 8 (logand 8 (getvar 'undoctl)))
        (vla-endundomark doc)
    )
)

 

1529094014_2022-03-08172515.thumb.gif.d6f1b3e35d56e03c056722f94d0fec66.gif

 

 

I made this because I got tired of classifying it with QSELECT and matching it, with layers that are not separated.

Layers are very important.

 

And in general, in my work, hatch often has properties different from line.

The gif was hatched on the table.. but hatches usually in a tray or pipe. 

 

polyines are treated like lines.

 

If there is no text or hatch, the properties of the text or hatch are not changed.

 

 

The difference between inch and mm unit of hatch pattern file by measurement sysvar could not be resolved.

I think that when I bring hatches of different measurement sysvars and paste them into one drawing,

the hatch scale seems to be applied properly when the scale is modified once and then restored to the original value.

 

Since there may be cases where the drawings are already mixed in the existing drawings, I could not modify them.

Edited by exceed
  • Like 3
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...