Jump to content

Need help with dynamic DCL, storing the outpuut gives errors..


Recommended Posts

Posted

Hello all,

 

I am working on a nice feature for AutoCAD MAP 3D.

Attached is a CSV and a LSP file.

 

When i run the command: IMPORTOBJECTDATA, 'Object Data' tables are created from the Excelfile. this works perfect.

Now... when i attach the table to a polyline, all properties are visible.

 

By default, AutoCAD-MAP-3D Object Data does not have a pick-list function. I am trying to create it, and am VERY close.

 

When i run the command: MODIFYOBJECTDATA and select the polyline, a dynamic DCL is created with picklists, based off the Excelfile.

Reading the values and creating the picklists works fine.. BUT...

 

The (get_tile "accept" function is giving me some hard issues:

In the snippet below, the 'Verhardingen-Verband_options' is hard codes, but needs to be a variable field...

 

(action_tile "accept" "(progn
						(setq nr 0)
						(repeat (length obattlist)
							(set (read (strcat \"value\" (itoa nr))) (nth (atoi (get_tile (strcat (nth nr obattlist) \"_list\"))) Verhardingen-Verband_options))

							(setq nr (+ 1 nr))
						)
						(done_dialog 1)
					)")

 

I tried to replace it with:

(strcat (nth nr obattlist) \"_options\")

But gives errors...

 

Also:

(read (strcat (nth nr obattlist) \"_options\"))

... results in errors

 

Closest i get is:

;; Define actions for the dialog
					(action_tile "accept" "(progn
						(setq nr 0)
						(repeat (length obattlist)
							(set (read (strcat \"value\" (itoa nr))) (nth (atoi (get_tile (strcat (nth nr obattlist) \"_list\"))) (read (strcat (nth nr obattlist) \"_options\"))))

							(setq nr (+ 1 nr))
						)
						(done_dialog 1)
					)")

 

But gives this error:

The name VERHARDINGEN-MATERIAAL_OPTIONS is EXACTLY the same result as the first 'hard-coded' example...

so.... why does it give a error with a dynamic code... but works when it is hardcoded?

 

image.png.1b280906ae99a834b7997123b265addc.png

 

So for some reason... i cannot get it to work... stuck here for a few days now...

 

Please help!

IMPORTOBJECTDATA - kopie (3).lsp ObjectData.csv

Posted

Consp generally means that the argument isn't a list.

 

Have a test and use (type Verhardingen-Verband_options) in a princ or alert line to show what Verhardingen-Verband_options is. Let us know if it is a list because there is something else wrong otherwise

  • Like 1
Posted

Oh, for god sake.....

Sometimes you need to take a break at the right time....

 

I forgot to EVAL function, after the read, to actualy get the list, and not just the symbol name....

Problem solved!

 

;; Define actions for the dialog
					(action_tile "accept" "(progn
						(setq nr 0)
						(repeat (length obattlist)
							(set (read (strcat \"value\" (itoa nr))) (nth (atoi (get_tile (strcat (nth nr obattlist) \"_list\"))) (eval (read (strcat (nth nr obattlist) \"_options\")))))

							(setq nr (+ 1 nr))
						)
						(done_dialog 1)
					)")

 

  • 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...