Jump to content

Recommended Posts

Posted

I wrote this code earlier. inserting a diameter symbol on the dimension string as prefix. but not %%c but a square symbol wtih a line to mimic the diameter symbol

 

(defun  c:test (/ aDoc selset e str data p1 ) 
(defun MtexInfo ( mt /  db dl ds );;LM snippet
 (if 
   (and 
     (wcmatch (cdr (assoc 0 (setq dl (entget mt)))) "*DIMENSION") 
     (setq db (tblobjname "BLOCK" (cdr (assoc 2 dl)))) 
   ) 
   (while (and (setq db (entnext db)) (not ds)) 
     (if (eq "MTEXT" (cdr (assoc 0 (setq dl (entget db))))) 
       (setq ds (mapcar '(lambda (j) 
                                   (cdr (assoc j dl))) '(42 43 50 7 10)))) 
     ) 
   ) ds 
 )   
 (setq aDoc (vla-get-ActiveDocument (vlax-get-acad-object))) 
 (if (setq selset (ssget '((0 . "DIMENSION")))) 
   (repeat (sslength selset) 
     (setq e   (vlax-ename->vla-object (ssname selset 0)) 
       ) 
       (vla-put-Textprefix e 
         "{\\Fgdt|c0;\\H0.75x;o} " 
           ) 
     (setq data (mtexinfo (ssname selset 0))) 
     (entmakex 
       (list (cons 0 "LINE") 
         (cons 10 (setq p1 
              (polar (polar 
                  (last data) 
                  (+ pi (caddr data)) 
                  (- 
                    (/ (car data) 2.0) 
                    (* 
                      (/ (cadr data) 2.0) 
                      (* (cdr 
                           (assoc 41 (tblsearch "STYLE" (nth 3 data))) 
                           ) 
                         0.75 
                         ) 
                      ) 
                    ) 
                  ) 
                (+ (* pi 1.5) (caddr data)) 
                (/ (cadr data) 2.0) 
                ) 
             ) 
           ) 
         (cons 11 (polar p1 (+ (/ pi 2.0) (caddr data)) (cadr data))) 
         ) 
       ) 

     (ssdel (ssname selset 0) selset) 
     ) 
   ) 
 (princ) 
 )

 

Question is , How to tie the line (|) with the dimension? I'm a bit rusty with reactors and reluctant to push forward with the coding until i'm sure via object reactor is the best (or the ONLY) approach.

 

Any thoughts?

Posted

The symbol is for square feet? Isn't there a font that has that as part of its character set already?

Posted
The symbol is for square feet? Isn't there a font that has that as part of its character set already?

 

I'm sure there is.. but AFAICT its limited to a particular font type. need one that can be used from an "out-of-the box" / un-customized cad pacakge, plus not sure where to look :lol:

Posted

Whoa.. i'm surprise this query did not get any response suggestions/advise :?

 

Anyhoo... guess i'll just shelve this code for now :)

 

Thanks

Posted

Maybe this program will point you in the right direction, it is also associating one object with another.

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