It doesn't work, get this error:
; error: no function definition: M:SAFELIST
do you know what it means?
|
It doesn't work, get this error:
; error: no function definition: M:SAFELIST
do you know what it means?
In this case, it just means that Opie's code included a call for a sub-routine (external?).
Often times someone provides you a snippet of code, which has been culled from a larger routine, and there may be missing, or extra code.
Opie may be able to provide it to you, or at least tell you what it does, so you can develop your own sub-routine.
Missing sub-routine:
"How we think determines what we do, and what we do determines what we get."
Sincpac C3D ~ Autodesk Exchange Apps
Computer Specs:
Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000
m:safelist is shorthand to handle the conversion of a safearray to a list. I also, have it to check for a variant being passed as the argument.
Code:;_ Convert Safearray to list (defun m:safelist (value) (if (= (type value) 'VARIANT) (setq value (m:variantvalue value)) ) (setq value (vl-catch-all-apply 'vlax-safearray->list (list value))) (if (vl-catch-all-error-p value) nil value ) ) (defun m:variantvalue (value) (setq value (vl-catch-all-apply 'vlax-variant-value (list value))) (if (vl-catch-all-error-p value) nil value ) )
If you have a technical question, please find the appropriate forum and ask it there.
You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
jUSt
good good job man!!!! It works..
now I'll improve this lisp to automatically complete name and date
I try this in my machine and it works, but when I try in another machine, I get this error:
Select entity: ; error: bad function: VLAX-ENAME->VLA-OBJECT
what happens, I tried in autocad mechanical 2009 and 2010
Entere this at the command line:
Then try Opie's code again... Does it work now?Code:(vl-load-com)
If so, then add the code I provided above to ACADDOC.lsp. If not, then please paste what the command line says.
Hope this helps!
"How we think determines what we do, and what we do determines what we get."
Sincpac C3D ~ Autodesk Exchange Apps
Computer Specs:
Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000
I used it but I can improve this lisp, what can I do to automatically save as path example (c:\as built\) and to automatic save in the revision, example:
tre drawing is save in c:\041.00_01.00.071_02revA and when I make the revision it goes to revision B, 041.00_01.00.071_02revB, if is it possible to run the lisp and it automatic save the dwg in c:\as built\041.00_01.00.071_02revB
You could do so through calling the saveas command. Although you need to check if the file is overwriting something else, one of 2 ways: use the while-cmdactive idea (see some other threads here); or do a findfile first.
You get hold of the current drawing's path using (getvar "DWGPREFIX"). The current dwg's name with (getvar "DWGNAME"). Then combine them and any other portions you want using strcat. You may also need to look at the vl-file-directory-p function to check if the as built folder exists or not, and if not then use vl-mkdir.
You could use the document's activex object's SaveAs method so you don't see anything on the command line - but seeing as you're going to run it in a script I think that's over kill.