Jump to content

Auto change justification


richard3009

Recommended Posts

I have 200 drgs with the drawing numbers justified incorrectly what sort of lisp routine could i target them with, all the first 8 digits of the drg numbers are the same on each one so a wild card targeting should work.

Link to comment
Share on other sites

refer to this thread for text justification (soulution by Lee Mac)

 

http://www.cadtutor.net/forum/showthread.php?29254-Text-Justification-Routine-Help&highlight=text+justification

 

The routine is easy.. the real problem is running in through 200 drawings,

just remember to change the DXF 72 code to suite your needs.

heres a guide:

 

;DXF 72

; Horizontal text justification type (optional, default = 0) integer codes (not bit-coded)

;

;0 = Left; 1= Center; 2 = Right

;

;3 = Aligned (if vertical alignment = 0);

;

;4 = Middle (if vertical alignment = 0);

;

;5 = Fit (if vertical alignment = 0);

;

;See the Group 72 and 73 integer codes table for clarification

 

Now you can either use a script or used ObjectDBX (which i'm still trying to learn :))

 

 

still you need a routine for string matching...

 

(wcmatch "your string" "pattern*")

Link to comment
Share on other sites

chagne the line 11 to something like this..

 

(IF  (AND (= enttyp "TEXT")
       (wcmatch (cdr (assoc 1 ent1)) "YOUR 8 DIGIT*")
)
)
(progn .....

 

and oh.. dont forget to change dxf 72 to suit you neeeds

 

:)

Link to comment
Share on other sites

Wow - that is old code, I'm embarassed to see that dragged up again lol :oops:

 

Here is a quick code, slapped together:

 

(defun c:tJust ( / 72code 73code ss )
 ;; © Lee Mac 2010

 (setq 72code 1 73code 2)

 (if (setq ss (ssget "_X" '((0 . "TEXT") (1 . "12345678*"))))
   (
     (lambda ( i / x l )
       (while (setq x (ssname ss (setq i (1+ i)))) (setq l (entget x))
         (entupd
           (cdr
             (assoc -1
               (entmod
                 (subst (cons 72 72code) (assoc 72 l)
                   (subst (cons 73 73code) (assoc 73 l)
                     (subst
                       (cons 11 (cdr (assoc 10 l))) (assoc 11 l) l
                     )
                   )
                 )
               )
             )
           )
         )
       )
     )
     -1
   )
 )
 
 (princ)
)

 

Change the 72/73 code and filter as necessary.

Link to comment
Share on other sites

Man!!! 2008!!

 

:oops: Now I’m embarrassed.. apologies Lee Mac

 

You’ve come a long way since then..

Think of it this way, you wouldn’t have gotten as good as you are if you hadn’t gone through all that

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