2009-08-09 07:42 UTC
Hello All. I'll try to give a synopsis and post the applicable code snippets, I'd really rather not post the entire thing as it is 1,000 lines and some of it is sensitive. Basically, I have a user interface that generates global variables, and calls a function (to make a grid of blocks) with a list of names and the directory they're in, and this grid making function calls another function that actually inserts a block based on an insertion point, directory, and filename. Each of these pieces work fine in practice, and when I step through it manually it works fine.
Any help is greatly appreciated because i'm pulling my hair out and can't figure out why this isn't working.
(defun c:btnBuild_OnClicked (/ filelist counter)
(setq filelist (dcl_ListBox_GetSelectedItems lstBlocks))
(setq counter 0)
(dcl_Control_SetMinValue prgBuild 0)
(dcl_Control_SetMaxValue prgBuild (length filelist))
(getprofvars)
(blkmxgrid selectedfolder filelist)
)
(defun blkmxgrid (directory blocklist / local_origin blockcount counter rowcount colcount gridcount xloc yloc)
...
(blkmx directory (nth counter blocklist) (list xloc yloc 0))
(defun blkmx ( block_path block_name local_origin / block_instance block_rect
block_width block_height block_scale
l_block_ulx l_block_uly block_TUL block_UL
blockins text_instance text_width l_text_ulx
l_text_uly text_TUL text_UL XLL XLR XUR XUL)
(if (vl-cmdf "insert" (strcat block_path "\\" block_name) local_origin "1" "1" "0")
(setq block_instance (entlast))
(progn
(princ (strcat "I just failed with: " block_path "(" (vl-princ-to-string(type block_path)) ") and " block_name "(" (vl-princ-to-string(type block_name)) ") and " (vl-princ-to-string local_origin) "(" (vl-princ-to-string(type local_origin)) ")"))
(exit)
)
) <- This piece fails, and says that i'm calling an invalid function ( I think ). I used the if statement to check the variables, and they are all fine, and when i call the (vl-cmdf "insert" .... ) function with them manually it works fine as well.
Any help is greatly appreciated because i'm pulling my hair out and can't figure out why this isn't working.
(defun c:btnBuild_OnClicked (/ filelist counter)
(setq filelist (dcl_ListBox_GetSelectedItems lstBlocks))
(setq counter 0)
(dcl_Control_SetMinValue prgBuild 0)
(dcl_Control_SetMaxValue prgBuild (length filelist))
(getprofvars)
(blkmxgrid selectedfolder filelist)
)
(defun blkmxgrid (directory blocklist / local_origin blockcount counter rowcount colcount gridcount xloc yloc)
...
(blkmx directory (nth counter blocklist) (list xloc yloc 0))
(defun blkmx ( block_path block_name local_origin / block_instance block_rect
block_width block_height block_scale
l_block_ulx l_block_uly block_TUL block_UL
blockins text_instance text_width l_text_ulx
l_text_uly text_TUL text_UL XLL XLR XUR XUL)
(if (vl-cmdf "insert" (strcat block_path "\\" block_name) local_origin "1" "1" "0")
(setq block_instance (entlast))
(progn
(princ (strcat "I just failed with: " block_path "(" (vl-princ-to-string(type block_path)) ") and " block_name "(" (vl-princ-to-string(type block_name)) ") and " (vl-princ-to-string local_origin) "(" (vl-princ-to-string(type local_origin)) ")"))
(exit)
)
) <- This piece fails, and says that i'm calling an invalid function ( I think ). I used the if statement to check the variables, and they are all fine, and when i call the (vl-cmdf "insert" .... ) function with them manually it works fine as well.