Jump to content

Recommended Posts

Posted

Hello Everyone,

 

I’ve recently started researching ActiveX, DXF, and Visual Lisp, and I’m currently using The Visual Lisp Developer Bible by David Stein as a reference.

 

I encountered a small issue and was hoping someone might be able to assist me. When using the name "sa," everything works fine, but when I try using a different name, I receive an error.

Specially using the myarray, mat2 and sa(in string type)

 

Any help or guidance would be greatly appreciated!

 

See attached image on autocad command line

 

Thank you in advance.

 

PS: some of the sample I did is came with this link https://help.autodesk.com/view/ACDLT/2025/ENU/?guid=GUID-7C2331B4-1A4D-40FF-B59A-D35F7942936B

errormessage.PNG

Posted

Not sure here but do you need to define myarray or mat2 as lists before you can use them (setq myarray (list))

Posted

Hi stevenP

 

Thank you for taking time for my thread.

 

Actually as per my reference the output should be 

for mat2 using the (vlax-saferray->list mat2)

result/ouput should be (("a" "b" "c") ("d" "e" "f"))

 

But on my command line the output for mat2 is ; error: bad argument 

 

I don't know why didn't get the same result with the reference.

 

 

Posted (edited)

I get this lines correctly in BricsCAD V23 :

 

: (setq mat2 (vlax-make-safearray vlax-vbString '(0 . 1) '(1 . 3)))
#<safearray...>
: (vlax-safearray-fill mat2 '(("a" "b" "c") ("d" "e" "f")))
#<safearray...>
: (vlax-safearray->list mat2)
(("a" "b" "c") ("d" "e" "f"))

 

And in AutoCAD 2022 :

 

Command: (setq mat2 (vlax-make-safearray vlax-vbString '(0 . 1) '(1 . 3)))
#<safearray...>

Command: (vlax-safearray-fill mat2 '(("a" "b" "c") ("d" "e" "f")))
#<safearray...>

Command: (vlax-safearray->list mat2)
(("a" "b" "c") ("d" "e" "f"))

 

Edited by marko_ribar
Posted

This kind a weird, it is now working. I don't know what went wrong as you may see in the attach file

Posted

A bit of a guess here.... yesterday (?) you asked and today it is magically fixed after restarting the computer overnight and restarting CAD... might be that you need to localise your variables and yesterday it was picking up values you were using elsewhere? That is my number 1 cause of something working today that didn't work yesterday

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...