Updating DWG Properties with AutoLisp

Updating DWG Properties with AutoLisp

tcoley95E9Z
Enthusiast Enthusiast
470 Views
5 Replies
Message 1 of 6

Updating DWG Properties with AutoLisp

tcoley95E9Z
Enthusiast
Enthusiast

I made this program that takes 3 inputs for a custom DWGProps field, combines them, and then updates DWGProps accordingly. For some weird reason it seems to work fine the first few days but then I get this error:

tcoley95E9Z_0-1703086294628.png

The weird thing is if I type Regen in autocad, the dwgprops did in fact get updated. Any ideas? Code below, thanks!

 

(defun c:dProps () 
  
  (setq mmIn (getstring "\n Enter Month: ")) ;Input Month
  (setq ddIn (getstring "\n Enter Day: ")) ;Input Day
  (setq yyIn (getstring "\n Enter Year: ")) ;Input Year
  
  (setq dateVal (strcat mmIn "." ddIn "." yyin))

  (vl-load-com)
  ((vla-SetCustomByKey 
     (vla-get-summaryinfo 
       (vla-get-activedocument (Vlax-get-acad-object))) 
                     
        "Issue Date"  dateVal    ;First Field = Name // Second Field = Value                 
      ) 
  )     
  
 (command "-REGEN") ;Regen command to automatically show the updated props   
)  

 

 

0 Likes
471 Views
5 Replies
Replies (5)
Message 2 of 6

vladimir_michl
Advisor
Advisor

Your structure of parentheses is wrong - see the double "(" in:

((vla-set....

 

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

 

Message 3 of 6

paullimapa
Mentor
Mentor

since you're running vl routines might as well replace:

(command "_.REGEN")

with this:
(vla-Regen (vla-get-ActiveDocument (vlax-get-acad-object)) acActiveViewport)


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 4 of 6

tcoley95E9Z
Enthusiast
Enthusiast
Good to know! Is this preferred just to keep a consistent code throughout or is it faster?
0 Likes
Message 5 of 6

tcoley95E9Z
Enthusiast
Enthusiast
Thank you so much!
Message 6 of 6

paullimapa
Mentor
Mentor

there are advantages at times to using vlisp functions instead of relying on command line like this:

https://forums.augi.com/showthread.php?67100-regen-without-using-command


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes