formule in autocad

formule in autocad

peter__smith
Enthusiast Enthusiast
393 Views
3 Replies
Message 1 of 4

formule in autocad

peter__smith
Enthusiast
Enthusiast

Hi,

 

I have made in menu "drawing property", 2 field names: “test 1” and “test2”.  and I want to add a formule. If “test 1” is filled with text / not empty, then “test2” will show the letter “ok”.

 

Question:

Does someone know, how I can do that?

 

Kind regards,

Peter smith

0 Likes
Accepted solutions (1)
394 Views
3 Replies
Replies (3)
Message 2 of 4

vladimir_michl
Advisor
Advisor

There is no direct way to do that in AutoCAD. You will need an additional tool (e.g. a LISP routine) to auto-update the "test2" property - loaded on all workstations where the "test1" property may be changed.

 

Vladimir Michl, www.arkance.world  -  www.cadforum.cz

 

Message 3 of 4

Moshe-A
Mentor
Mentor

@peter__smith hi,

 

let's make things clear first

"drawing property" is a block with 2 attributes (fields) test1, test2 ?

 

why 2 fields is needed...if test1 is not empty, it is clear OK. if test1 is empty, it is clear wrong.

 

sounds logic?

 

Moshe

 

 

Message 4 of 4

Rick_Tolleshaug_TSC
Advocate
Advocate
Accepted solution

Here are two programming methods...

 

 

;; METHOD 1 - Using DOSLib (Robert McNeel)
;; setting field value to "" deletes entire field therefore " " (space) is used to clear "Test2"
(defun dwgpropf ()
  (dos_custominfo "Test2" (if (= (dos_custominfo "Test1") "") " " "ok"))
)

;; METHOD 2 - Using ActiveX
(defun dwgpropf (/ si v1)
  (setq si
    (vla-get-SummaryInfo 
      (vla-get-ActiveDocument 
        (vlax-get-acad-object))))
  (vla-GetCustomByKey si "Test1" 'v1)
  (vla-SetCustomByKey si "Test2" (if (= v1 "") "" "ok"))
)

 

 

 

0 Likes