- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Below is a code that I have been working on to pull values from the "Title Block" and sets those values to variables so I can export them to an Excel file later on. I can use the below code to edit the values (vla-put-textstring att), but I can't pull them into a variable for some reason. The line that is giving me trouble is "(setq customer (vla-get-textstring att))". (Its not just the customer though, its all of the lines that are trying to assign the value to a variable) I receive the error "bad argument type: FILE "XXXXXXX" (With "XXXXXXX" being the value that is currently in the block attribute). I'm sure its something small that I am overlooking as I am quite the novice, but thank you for your time and input.
(setq ss1 (ssget "X" (list '(0 . "INSERT") (cons 2 "TITLEBLOCKTA"))))
(repeat (setq i (sslength ss1))
(princ "\nGrabbing From BOM")
(foreach att (vlax-invoke (vlax-ename->vla-object (ssname ss1 (setq i (1- i)))) 'getattributes)
;Get Job Number
(if (= "TB-JOB" (strcase (vla-get-tagstring att)))
(progn
(princ "\nGrabbing Job Number")
(setq jobnum (strcase (vla-get-textstring att)))
(princ "\n" jobnum)
)
)
;Get Descritpion
(if (= "TB-TITLE1" (strcase (vla-get-tagstring att)))
(progn
(princ "\nGrabbing Description")
(setq description (strcase (vla-get-textstring att)))
(princ "\n" description)
)
)
;Get Customer
(if (= "TB-CLIENT" (strcase (vla-get-tagstring att)))
(progn
(princ "\nGrabbing Customer")
(setq customer (vla-get-textstring att))
(princ "\n" customer)
)
)
;Get City and State
(if (= "TB-LOCATION" (strcase (vla-get-tagstring att)))
(progn
(princ "\nGrabbing Location")
(setq citystate (strcase (vla-get-textstring att)))
(princ "\n" citystate)
)
)
;Variables Recieved----------
;Job Number - jobnum
;Description - description
;Customer - customer
;City and State - citystate (TOWN, STATE ABBR.)
);foreach
);repeat
Solved! Go to Solution.