Function to edit Attributes No Longer Working AutoCAD 2020

Function to edit Attributes No Longer Working AutoCAD 2020

zale-86
Contributor Contributor
1,843 Views
18 Replies
Message 1 of 19

Function to edit Attributes No Longer Working AutoCAD 2020

zale-86
Contributor
Contributor

I've used this function since AutoCAD 2008 and now it does not work on a machine loaded with AutoCAD 2020. Does anyone know what has been discontinued and if there is a workaround?

 

Here is the function. It gets fed the variables from several routines that populate various blocks

 

(defun EditAttribute (Blkname Tagname editString / result ss objLst)

(setq result 0 ss (ssget "_X" (list (cons 0 "INSERT") (cons 66 1) (cons 2 Blkname))))

(setq objLst

(mapcar 'vlax-ename->vla-object

(vl-remove-if-not '(lambda(x)(= (type x) 'ENAME))

(mapcar 'cadr (ssnamex ss)))))

(mapcar (function (lambda(blk)

(mapcar (function (lambda(att)

(setq attTagname (strcase (vla-get-TagString att)))

(if (= attTagname (strcase Tagname))

(progn

(vla-put-TextString att editString)

(setq result (1+ result))

)

)

))

(vlax-invoke blk 'GetAttributes))

))

objLst)

result

); end function

0 Likes
1,844 Views
18 Replies
Replies (18)
Message 2 of 19

ВeekeeCZ
Consultant
Consultant

(vl-load-com)

loaded?

Does it say anything at the command-line?

 

If you don't know, add that line prior to the code and reload.

0 Likes
Message 3 of 19

ronjonp
Mentor
Mentor

The code works in AutoCAD 2021 for me.

FWIW this could code could be condensed to this. Also good to check if you have a valid selection set before passing to (ssnamex ss).

(defun editattribute (blkname tagname editstring / result ss)
  (if (setq ss (ssget "_X" (list (cons 0 "INSERT") (cons 66 1) (cons 2 blkname))))
    (progn (setq result 0)
	   (foreach blk	(mapcar 'vlax-ename->vla-object (mapcar 'cadr (ssnamex ss)))
	     (foreach att (vlax-invoke blk 'getattributes)
	       (if (= (strcase (vla-get-tagstring att)) (strcase tagname))
		 (progn (vla-put-textstring att editstring) (setq result (1+ result)))
	       )
	     )
	   )
    )
  )
  result
)
Message 4 of 19

hencoop
Advisor
Advisor

It appears that Visual Lisp is not initialized.  If you run any other function that does initialize Visual Lisp before this one it would likely work.

put (VL-LOAD-COM) before the Visual Lisp calls in your function and it should work again.

AutoCAD User since 1989. Civil Engineering Professional since 1983
Product Version: 13.6.1963.0 Civil 3D 2024.4.1 Update Built on: U.202.0.0 AutoCAD 2024.1.6
                        27.0.37.14 Autodesk AutoCAD Map 3D 2024.0.1
                        8.6.52.0 AutoCAD Architecture 2024
0 Likes
Message 5 of 19

zale-86
Contributor
Contributor

Alas, I already have the (VL-Load-Com) so that's not it. There is no error of meaning, just the basic crap-out

AutoCAD variable setting rejected: "cmdecho" nil

Again, I've run this routine on virtually every version of AutoCAD since 2008 and it's only now with 2020 that it does not work.

0 Likes
Message 6 of 19

ronjonp
Mentor
Mentor

Your error message sounds like it's coming from something else. Not the code provided. Maybe post your whole routine?

0 Likes
Message 7 of 19

zale-86
Contributor
Contributor

Routine starts by asking for what end up as the attribute values. That all works fine.

Then it populates the attributes and moves on to a VBA routine, but never gets that far.

 

Warning, my code is anything but concise or pretty, but up til now gets the job done

 

(defun c:Submittal ( / result subDate1 subDate2 subDate3 subDate4 subDate5
subWhy1 subWhy2 subWhy3 subWhy4 subWhy5
subTo1 subTo2 subTo3 subTo4 subTo5)

(vl-load-com)



(command "-layer" "ON" "*" "")

(command "-layer"
"OFF"
"Cutlist-FULL,*|Cutlist-FULL,Cutlist-2,*|Cutlist-2,Cutlist-4,*|Cutlist-4,Cutlist-8,*|Cutlist-8,Cutlist-12,*|Cutlist-12,Cutlist-16,*|Cutlist-16,Cutlist-24,*|Cutlist-24,Cutlist-32,*|Cutlist-32,Cutlist-48,*|Cutlist-48,Cutlist-96,*|Cutlist-96"
"")

(initget "ONE ALL")
(setq PROCESS (getkword "\n(O)ne Tab or (A)ll? : "))
(If (= PROCESS "ALL")(Setvar "UserS1" "ALL"))
(If (= PROCESS "ONE")(Setvar "UserS1" "CTAB"))



(setq SubNum (getstring "\nEnter Submittal Number <1-5> : "))
(Setq Date (YMD))
(If ( = SubNum "1")
(Progn
(setvar "useri3" 1)
(setq SubDate1 (getstring 1"\nEnter Submittal Date or Enter for Today: "))

(If (= SubDate1 "") (setq Subdate1 Date))

(initget "Approval Resubmittal ForRecord")

(setq 1SubWhy (getkword "\nfor (A)pproval/(R)esubmit for approval/(F)or record: "))

(If (= 1SubWhy "Approval")(Setq SubWhy1 "FOR APPROVAL"))

(If (= 1SubWhy "Resubmittal")(Setq SubWhy1 "RESUBMIT FOR APPROVAL"))

(If (= 1SubWhy "ForRecord")(Setq SubWhy1 "SUBMIT FOR RECORD"))

(If (= 1SubWhy "Approval")(Setq SubStatus "OUT FOR APPROVAL"))

(If (= 1SubWhy "Resubmittal")(Setq SubStatus "OUT FOR APPROVAL"))

(If (= 1SubWhy "ForRecord")(Setq SubStatus "RECORD SET"))


(If (= 1SubWhy "Approval")(setvar "users4" "SUBMITTAL PENDING"))

(If (= 1SubWhy "Resubmittal")(setvar "users4" "RESUBMITTAL PENDING"))

(If (= 1SubWhy "ForRecord")(setvar "users4" "RESUBMITTAL PENDING"))


(setq SubTo1 (getstring 1"\nSubmitted to: "))
)
)

(If ( = SubNum "2")
(Progn
(setvar "useri3" 2)

(setq SubDate2 (getstring 2"\nEnter Submittal Date or Enter for Today: "))

(If (= SubDate2 "") (setq Subdate2 Date))

(initget "Approval Resubmittal ForRecord")

(setq 2SubWhy (getkword "\nfor (A)pproval/(R)esubmit for approval/(F)or record: "))

(If (= 2SubWhy "Approval")(Setq SubWhy2 "FOR APPROVAL"))

(If (= 2SubWhy "Resubmittal")(Setq SubWhy2 "RESUBMIT FOR APPROVAL"))

(If (= 2SubWhy "ForRecord")(Setq SubWhy2 "SUBMIT FOR RECORD"))

(If (= 2SubWhy "Approval")(Setq SubStatus "OUT FOR APPROVAL"))

(If (= 2SubWhy "Resubmittal")(Setq SubStatus "OUT FOR APPROVAL"))

(If (= 2SubWhy "ForRecord")(Setq SubStatus "RECORD SET"))


(setq SubTo2 (getstring 2"\nSubmitted to: "))
)
)


(If ( = SubNum "3")
(Progn
(setvar "useri3" 3)
(setq SubDate3 (getstring 3"\nEnter Submittal Date or Enter for Today: "))

(If (= SubDate3 "") (setq Subdate3 Date))

(initget "Approval Resubmittal ForRecord")

(setq 3SubWhy (getkword "\nfor (A)pproval/(R)esubmit for approval/(F)or record: "))

(If (= 3SubWhy "Approval")(Setq SubWhy3 "FOR APPROVAL"))

(If (= 3SubWhy "Resubmittal")(Setq SubWhy3 "RESUBMIT FOR APPROVAL"))

(If (= 3SubWhy "ForRecord")(Setq SubWhy3 "SUBMIT FOR RECORD"))

(If (= 3SubWhy "Approval")(Setq SubStatus "OUT FOR APPROVAL"))

(If (= 3SubWhy "Resubmittal")(Setq SubStatus "OUT FOR APPROVAL"))

(If (= 3SubWhy "ForRecord")(Setq SubStatus "RECORD SET"))


(setq SubTo3 (getstring 3"\nSubmitted to: "))
)
)

(If ( = SubNum "4")
(Progn
(setvar "useri3" 4)
(setq SubDate4 (getstring 4"\nEnter Submittal Date or Enter for Today: "))

(If (= SubDate4 "") (setq Subdate4 Date))

(initget "Approval Resubmittal ForRecord")

(setq 4SubWhy (getkword "\nfor (A)pproval/(R)esubmit for approval/(F)or record: "))

(If (= 4SubWhy "Approval")(Setq SubWhy4 "FOR APPROVAL"))

(If (= 4SubWhy "Resubmittal")(Setq SubWhy4 "RESUBMIT FOR APPROVAL"))

(If (= 4SubWhy "ForRecord")(Setq SubWhy4 "SUBMIT FOR RECORD"))

(If (= 4SubWhy "Approval")(Setq SubStatus "OUT FOR APPROVAL"))

(If (= 4SubWhy "Resubmittal")(Setq SubStatus "OUT FOR APPROVAL"))

(If (= 4SubWhy "ForRecord")(Setq SubStatus "RECORD SET"))


(setq SubTo4 (getstring 4"\nSubmitted to: "))
)
)

(If ( = SubNum "5")
(Progn
(setvar "useri3" 5)
(setq SubDate5 (getstring 5"\nEnter Submittal Date or Enter for Today: "))

(If (= SubDate5 "") (setq Subdate5 Date))

(initget "Approval Resubmittal ForRecord")

(setq 5SubWhy (getkword "\nfor (A)pproval/(R)esubmit for approval/(F)or record: "))

(If (= 5SubWhy "Approval")(Setq SubWhy5 "FOR APPROVAL"))

(If (= 5SubWhy "Resubmittal")(Setq SubWhy5 "RESUBMIT FOR APPROVAL"))

(If (= 5SubWhy "ForRecord")(Setq SubWhy5 "SUBMIT FOR RECORD"))


(If (= 5SubWhy "Approval")(Setq SubStatus "OUT FOR APPROVAL"))

(If (= 5SubWhy "Resubmittal")(Setq SubStatus "OUT FOR APPROVAL"))

(If (= 5SubWhy "ForRecord")(Setq SubStatus "RECORD SET"))


(setq SubTo5 (getstring 5"\nSubmitted to: "))
)
)

(VL-LOAD-COM)

(if (and (/= NIL SubDate1)(/= SubDate1 ""))(setq result (EditAttribute2 "Submittals" "SubDATE1" SubDate1 )))
(if (and (/= NIL SubWhy1)(/= SubWhy1 ""))(setq result (EditAttribute2 "Submittals" "SubWhy1" SubWhy1 )))
(if (and (/= NIL SubTo1)(/= SubTo1 ""))(setq result (EditAttribute2 "Submittals" "SubTo1" SubTo1 )))

(if (and (/= NIL SubDate2)(/= SubDate2 ""))(setq result (EditAttribute2 "Submittals" "SubDATE2" SubDate2 )))
(if (and (/= NIL SubWhy2)(/= SubWhy2 ""))(setq result (EditAttribute2 "Submittals" "SubWhy2" SubWhy2 )))
(if (and (/= NIL SubTo2)(/= SubTo2 ""))(setq result (EditAttribute2 "Submittals" "SubTo2" SubTo2 )))

(if (and (/= NIL SubDate3)(/= SubDate3 ""))(setq result (EditAttribute2 "Submittals" "SubDATE3" SubDate3 )))
(if (and (/= NIL SubWhy3)(/= SubWhy3 ""))(setq result (EditAttribute2 "Submittals" "SubWhy3" SubWhy3 )))
(if (and (/= NIL SubTo3)(/= SubTo3 ""))(setq result (EditAttribute2 "Submittals" "SubTo3" SubTo3 )))

(if (and (/= NIL SubDate4)(/= SubDate4 ""))(setq result (EditAttribute2 "Submittals" "SubDATE4" SubDate4 )))
(if (and (/= NIL SubWhy4)(/= SubWhy4 ""))(setq result (EditAttribute2 "Submittals" "SubWhy4" SubWhy4 )))
(if (and (/= NIL SubTo4)(/= SubTo4 ""))(setq result (EditAttribute2 "Submittals" "SubTo4" SubTo4 )))

(if (and (/= NIL SubDate5)(/= SubDate5 ""))(setq result (EditAttribute2 "Submittals" "SubDATE5" SubDate5 )))
(if (and (/= NIL SubWhy5)(/= SubWhy5 ""))(setq result (EditAttribute2 "Submittals" "SubWhy5" SubWhy5 )))
(if (and (/= NIL SubTo5)(/= SubTo5 ""))(setq result (EditAttribute2 "Submittals" "SubTo5" SubTo5 )))


(If(not(wcmatch SubStatus "RECORD SET"))
(progn
(setq result (EditAttribute2 "DrawingInformation" "Status" SubStatus))


(princ (cond ((= result 0)"Nothing changed.")

((= result 1)"Changed one attribute.")

(T (strcat "Changed "(itoa result) " attributes."))

))

))


(DWGInfo)

(setvar "userS3" JOBNUMBER)
(setvar "userS2" JOBYEAR)
(setvar "userS4" SERIES)

(princ)

(command "-vbarun" "exportattribsSubmittals" "")

)
0 Likes
Message 8 of 19

ronjonp
Mentor
Mentor

No 'cmdecho' in all that code. It could be a global variable messing with you.

 

; Global variables: (1SUBWHY 2SUBWHY 3SUBWHY 4SUBWHY 5SUBWHY DATE JOBNUMBER JOBYEAR PROCESS SERIES SUBNUM SUBSTATUS)

There could be errors in your other two functions not included: (dwginfo) (ymd)

 

0 Likes
Message 9 of 19

ronjonp
Mentor
Mentor

@zale-86 

FWIW, here's some food for thought to tidy up the code a bit and remove unneeded lines:

(if (= subnum "1")
  (progn (setvar "useri3" 1)
	 (setq subdate1 (getstring t "\nEnter Submittal Date or Enter for Today: "))
	 (if (= subdate1 "")
	   (setq subdate1 date)
	 )
	 ;; Only three options to choose from here
	 (initget "Approval Resubmittal ForRecord")
	 (setq 1subwhy (getkword "\nfor (A)pproval/(R)esubmit for approval/(F)or record: "))
	 ;; Use COND like so to tidy up only include the 3 above :)
	 (setq substatus (cond ((= 1subwhy "Approval") "FOR APPROVAL")
			       ((= 1subwhy "Resubmittal") "RESUBMIT FOR APPROVAL")
			       ((= 1subwhy "ForRecord") "SUBMIT FOR RECORD")
			 )
	 )
;;;	 (if (= 1subwhy "Approval")
;;;	   (setq substatus "OUT FOR APPROVAL")
;;;	 )
;;;	 (if (= 1subwhy "Resubmittal")
;;;	   (setq substatus "OUT FOR APPROVAL")
;;;	 )
;;;	 (if (= 1subwhy "ForRecord")
;;;	   (setq substatus "RECORD SET")
;;;	 )
;;;	 (if (= 1subwhy "Approval")
;;;	   (setvar "users4" "SUBMITTAL PENDING")
;;;	 )
;;;	 (if (= 1subwhy "Resubmittal")
;;;	   (setvar "users4" "RESUBMITTAL PENDING")
;;;	 )
;;;	 (if (= 1subwhy "ForRecord")
;;;	   (setvar "users4" "RESUBMITTAL PENDING")
;;;	 )
	 (setq subto1 (getstring t "\nSubmitted to: "))
  )
)

 

0 Likes
Message 10 of 19

zale-86
Contributor
Contributor

Whacky.

I use (YMD) and (DWGINFO) in tons of other routines that all work fine on this machine

and no cmdecho in either of them either

 

;YMD returns the current date as yyyy-mm-dd

(defun YMD ( / D YR MO DAY)
(setq D (rtos (getvar "CDATE") 2 6) ;gets the Julian date
YR (substr D 1 4) ;records year, without "19"
MO (substr D 5 2) ;records month number
DAY (substr D 7 2) ;records the day number
)
(strcat YR "-" MO "-" DAY) ;puts it all together
)

 

 

 

;DWGInfo returns various drawing related bits of info

(defun DWGInfo( / result)

(setq PATH (getvar "dwgprefix"))
(setq NUM (strlen PATH))
(setq NAME (substr PATH 1 (- NUM 17)))
(setq NAM (getvar "dwgname"))

(IF (= 1(countchrs "_" (getvar "dwgname")))
(progn
(setq JOBYEAR (substr NAME 18 2))
(setq JOBNUMBER (substr NAME 21 5))
(setq SERIES (substr NAM 8 2))
(setq PROFILE (substr NAM 8 6))
)
)

(IF (= 2(countchrs "_" (getvar "dwgname")))
(progn

(setq
arrFileName (sdtol(getvar "dwgname") "_")
FullJobNumber (nth 0 arrFileName)
SERIES (nth 1 arrFileName)
)
(setq
arrFileName (sdtol(getvar "dwgname") "_")
FullJobNumber (nth 0 arrFileName)
PROFILE (nth 1 arrFileName)
)
(setq
arrJobNumber (sdtol FullJobNumber "-")
JOBNUMBER (nth 1 arrJobNumber)
JOBYEAR (nth 0 arrJobNumber)
)
)
)

)

0 Likes
Message 11 of 19

ronjonp
Mentor
Mentor

You're going to have to do some sleuthing. Looks like there are many more variables at play and the unlocalized ones can bite you in the @$$. Good luck!

0 Likes
Message 12 of 19

zale-86
Contributor
Contributor

That's what I was afraid you'd say which is why I'm reaching out! Thank you so much for cleaning up my conditional statement. I will try to assimilate what you did with it. I'm completely self taught via the interwebs and my understanding is clearly limited. 

The bottom line is that in my opinion with every iteration of AutoCAD things seem to go down hill....

0 Likes
Message 13 of 19

pbejse
Mentor
Mentor

@zale-86 wrote:

That's what I was afraid you'd say which is why I'm reaching out! Thank you so much for cleaning up my conditional statement. I will try to assimilate what you did with it. I'm completely self taught via the interwebs and my understanding is clearly limited. 

The bottom line is that in my opinion with every iteration of AutoCAD things seem to go down hill....


At what point does it basic crap-out happens? Does it error out after editattribute function?  and you're sure that its not (DWGInfo) or YMD then it an only be the all to VBARUN. perhaps VBS is not installed?  or even exportattribsSubmittals not loaded or not found.

 

A callback to cmdecho produce this error AutoCAD variable setting rejected: "cmdecho" nil"   most likely from an error function 

(setvar "cmdecho" Variable) .< where Variable is not defined

 

You can find out for yourself by using the Debug Tool to track down where the program stalls.

Vlide/Deubug/Break on Error..


stalls.png

 

 

 

 

 

 

 

 

 

 

 

 

 

Visual LISP Editor  <-- How to...

 

HTH

 

 

0 Likes
Message 14 of 19

roland.r71
Collaborator
Collaborator

This could be caused by an *error* function, from a bad lisp (replacing the Original error function)

If inside that error function it tries to restore the CMDECHO like: (setvar 'cmdecho oldecho)

...and there is no oldecho set. This would be the result.

 

edit:

Woops, missed the part where @pbejse already mentioned that.

But it does seem the most likely problem. (Still that means there's an error somewhere with the current code which invokes another lisps error function.)

 

You could try to add a localized error function to prevent that from happening and see if that works

0 Likes
Message 15 of 19

roland.r71
Collaborator
Collaborator

I did just spot a possible cause for the error:

There is another custom function used inside dwginfo:

(setq
arrFileName (sdtol(getvar "dwgname") "_")
FullJobNumber (nth 0 arrFileName)
SERIES (nth 1 arrFileName)
)

 

Unless you have that sdtol function somewhere, acad will report:

; error: no function definition: SDTOL

 

This could be where the (wrong) error function gets invoked

0 Likes
Message 16 of 19

roland.r71
Collaborator
Collaborator

You forgot about his users4 var...

(& users hitting esc. or enter)

(if (= subnum "1")
   (progn 
      (setvar "useri3" 1)
      (setq subdate1 (getstring t "\nEnter Submittal Date or Enter for Today: "))
      (if (= subdate1 "")
         (setq subdate1 date)
      )
      (initget "Approval Resubmittal ForRecord")
      (setq 1subwhy (getkword "\nfor (A)pproval/(R)esubmit for approval/(F)or record: "))
      (cond 
         ((= 1subwhy "Approval")
            (setq substatus "FOR APPROVAL")
            (setvar "users4" "SUBMITTAL PENDING")
         )
         ((= 1subwhy "Resubmittal")
            (setq substatus "RESUBMIT FOR APPROVAL")
            (setvar "users4" "RESUBMITTAL PENDING")
         )
         ((= 1subwhy "ForRecord")
            (setq substatus "SUBMIT FOR RECORD")
            (setvar "users4" "RESUBMITTAL PENDING")
         )
         (t (prompt "\nNothing selected")(exit))
      )
      (setq subto1 (getstring t "\nSubmitted to: "))
   )
)

 

0 Likes
Message 17 of 19

roland.r71
Collaborator
Collaborator

Well, I'll take you're word for it, that it works (but i have my doubts), but it's been a long time since i've seen such overkill of if's 😁

 

I just couldn't resist rewriting the lot.

Some explanation should be in place, but there's just to much...

I'll advice you to take a good look at the IF & COND statements and the use of variables.

Both by comparing your code to mine and by reading up on them in a manual or tutorial.

 

- you REALY don't need to check a variable 3 times, for 3 different var=value

- there's no need to repeat the same code 5 times, for 1 different number

- you can't (setq ...) a sysvar, neither can you compare it just by name as regular variables. Always use setvar and getvar for those.

& are you sure the "result" variable is EVER going to be above 1?

- getstring 1""  -to-  getstring 5"" ???

 

See why I have my doubts that it works, correctly ?

 

and i found another custom function, not mentioned before:

EditAttribute2

 

So, here's the massively reduced code, which should do exactly the same (untested, bc: no sample dwg)

 

(vl-load-com)

(defun c:Submittal ( / result subDate subWhy subTo tag1 tag2 tag3)

   (command "-layer" "ON" "*" "")
   (command "-layer"
            "OFF"
            "Cutlist-FULL,*|Cutlist-FULL,Cutlist-2,*|Cutlist-2,Cutlist-4,*|Cutlist-4,Cutlist-8,*|Cutlist-8,Cutlist-12,*|Cutlist-12,Cutlist-16,*|Cutlist-16,Cutlist-24,*|Cutlist-24,Cutlist-32,*|Cutlist-32,Cutlist-48,*|Cutlist-48,Cutlist-96,*|Cutlist-96"
            ""
   )

   (while (= (getvar 'users1) "")
      (initget "ONE ALL")
      (setvar 'users1 (getkword "\n(O)ne Tab or (A)ll? : ")))
   )
   (If (= (getvar 'users1) "ONE")(setvar 'users1 "CTAB"))

   (while (not (getvar useri3))
      (setvar 'useri3 (getint "\nEnter Submittal Number <1-5> : "))
   )

   (Setq Date (YMD))

   (if (= (setq SubDate (getstring "\nEnter Submittal Date or Enter for Today: ")) "")(setq Subdate1 Date))

   (while (not SubWhy)
      (initget "Approval Resubmittal ForRecord")
      (setq SubWhy (getkword "\nfor (A)pproval/(R)esubmit for approval/(F)or record: "))
   )
   (cond
      ((= SubWhy "Approval")
         (Setq SubWhy "FOR APPROVAL" SubStatus "OUT FOR APPROVAL")
         (setvar 'users4 "SUBMITTAL PENDING")
      )
      ((= SubWhy "Resubmittal")
         (Setq SubWhy "RESUBMIT FOR APPROVAL" SubStatus "OUT FOR APPROVAL")
         (setvar 'users4 "RESUBMITTAL PENDING")
      )
      ((= SubWhy "ForRecord")
         (Setq SubWhy "SUBMIT FOR RECORD" SubStatus "RECORD SET")
         (setvar 'users4 "RESUBMITTAL PENDING")
      )
   )
   (while (or (not subTo)(= subTo ""))
      (setq SubTo (getstring T "\nSubmitted to: "))
   )

   (setq subnum (itoa (getvar 'useri3))
         tag1   (strcat "SubDATE" subnum)
         tag2   (strcat "SubWhy" subnum)
         tag3   (strcat "SubTo" subnum)
   )

   (setq result (EditAttribute2 "Submittals" tag1 SubDate))
   (setq result (EditAttribute2 "Submittals" tag2 SubWhy))
   (setq result (EditAttribute2 "Submittals" tag3 SubTo))

   (If (/= SubStatus "RECORD SET")
      (setq result (EditAttribute2 "DrawingInformation" "Status" SubStatus))
   )

   (princ (cond ((= result 0) "Nothing changed.")
                ((= result 1) "Changed one attribute.")
                (T (strcat "Changed "(itoa result) " attributes."))
   ))

   (DWGInfo)

   (setvar 'users2 JOBYEAR)
   (setvar 'users3 JOBNUMBER)
   (setvar 'users4 SERIES)
   
   (command "-vbarun" "exportattribsSubmittals" "")

   (princ)
)

 

 

0 Likes
Message 18 of 19

pbejse
Mentor
Mentor

@roland.r71 wrote:

This could be caused by an *error* function, from a bad lisp..

...

I did just spot a possible cause for the error:..

...

You forgot about his users4 var.

...

Well, I'll take you're word for it, that it works ..

 


Four posts  in a row @roland.r71 , you my friend are relentless 😁

I meant that in a good way.

 

 

Message 19 of 19

roland.r71
Collaborator
Collaborator

Thanx.

You know, sometimes i feel like i care more about solving other peoples problems as they do themselves.

If I post a question, I always check any reply ASAP.... but that's just silly ol' me 😋

 

In this case I wasn't planning on a fifth, before any response 😉

 

 

0 Likes