Author Topic: Issues compiling to VLX  (Read 5956 times)

0 Members and 1 Guest are viewing this topic.

squirreldip

  • Newt
  • Posts: 114
Issues compiling to VLX
« on: October 14, 2016, 01:58:16 PM »
I have a .cmd script which creates a .lsp file to write .dcl files by reading a folder containing source .dcl files.  I'm getting an error when using VLIDE to create a vlx from the .lsp :

Code: [Select]
; error: too many arguments: (PROGN (SETQ OUTFILE ( ... )) (PRINC "DUALCAR : dialog {\n" OUTFILE) (PRINC "                   label = \"RFL Dual Carriageway 3DPoly Creator\";\n" OUTFILE) ... )
The .lsp loads fine and executes correctly.

If anyone has any ideas it would be greatly appreciated.


squirreldip

  • Newt
  • Posts: 114
Re: Issues compiling to VLX
« Reply #1 on: October 14, 2016, 02:02:15 PM »
Is there a limit to how many lines can be contained within a (progn) block?

Edit:

Answer is yes (here)
« Last Edit: October 14, 2016, 02:05:42 PM by squirreldip »

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Issues compiling to VLX
« Reply #2 on: October 16, 2016, 07:08:31 PM »
I have a .cmd script which creates a .lsp file to write .dcl files by reading a folder containing source .dcl files.  I'm getting an error when using VLIDE to create a vlx from the .lsp :

Code: [Select]
; error: too many arguments: (PROGN (SETQ OUTFILE ( ... )) (PRINC "DUALCAR : dialog {\n" OUTFILE) (PRINC "                   label = \"RFL Dual Carriageway 3DPoly Creator\";\n" OUTFILE) ... )
The .lsp loads fine and executes correctly.

If anyone has any ideas it would be greatly appreciated.

I did not look your attached code. But can you replace the portion (princ "label = \"RFL…) with this:
Code: [Select]
(princ (strcat "label = \"RFL Dual Carriageway 3DPoly Creator\""
       "\n"
       OUTFILE
       ); end of strcat
)
(princ)

Note: take care of using ";" in a single line because ";" breaks the rest in the line.
Then you may be able to fix (princ "DUALCAR : dialog {\n" OUTFILE).

Please also have a look "strcat" function in help.

HTH

squirreldip

  • Newt
  • Posts: 114
Re: Issues compiling to VLX
« Reply #3 on: November 22, 2016, 11:41:29 AM »
Thanks MeasureUp - the suggestion should work.

I think the big issue for me was just not realizing that there is a limit.  I solved my problem by temporarily storing a list then iterating through that list.  Yours is probably better as no variable needs to be stored.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Issues compiling to VLX
« Reply #4 on: November 22, 2016, 01:51:18 PM »

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: Issues compiling to VLX
« Reply #5 on: November 23, 2016, 07:22:37 AM »
See: https://www.theswamp.org/index.php?topic=48883.0
I've never attempted to compile to VLX, but after reading this I thought would (repeat 1) can be an alternative of a loooong (progn).
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg

ribarm

  • Gator
  • Posts: 3279
  • Marko Ribar, architect
Re: Issues compiling to VLX
« Reply #6 on: November 23, 2016, 08:02:52 AM »
I was about to ask does anyone know limit of (setq var1 value1 var2 value2 ... )? I know this can be simplified by separating setq-es, but just for an info...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ChrisCarlson

  • Guest
Re: Issues compiling to VLX
« Reply #7 on: November 23, 2016, 12:56:21 PM »
Could the length of a progn issue be eliminated by creating a sub-function and simply calling it?

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Issues compiling to VLX
« Reply #8 on: November 23, 2016, 01:20:00 PM »
IMO, if you start to run up against the argument limits inherent in AutoLISP, you really need to take a step back and restructure your program; in the hundreds of thousands of lines of code I've written, I've never been troubled by the maximum number of arguments afforded by functions such as progn, cond etc.

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: Issues compiling to VLX
« Reply #9 on: November 23, 2016, 01:48:00 PM »
IMO, if you start to run up against the argument limits inherent in AutoLISP, you really need to take a step back and restructure your program; in the hundreds of thousands of lines of code I've written, I've never been troubled by the maximum number of arguments afforded by functions such as progn, cond etc.
Thats what"the List Manipulator" said.  :wink:
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg

ur_naz

  • Newt
  • Posts: 68
  • Made in Ukraine
Re: Issues compiling to VLX
« Reply #10 on: November 24, 2016, 05:52:23 PM »
You can add DCL to your VLX app. Making DCL on the fly is very bad idea.  :uglystupid2:

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Issues compiling to VLX
« Reply #11 on: November 24, 2016, 06:35:43 PM »
You can add DCL to your VLX app. Making DCL on the fly is very bad idea.  :uglystupid2:

DCL as part of a VLX application is still unencrypted and merely appended as plain text to the VLX file.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Issues compiling to VLX
« Reply #12 on: November 24, 2016, 08:35:11 PM »
Making DCL on the fly is very bad idea.  :uglystupid2:

Support this assertion please.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

ribarm

  • Gator
  • Posts: 3279
  • Marko Ribar, architect
Re: Issues compiling to VLX
« Reply #13 on: November 25, 2016, 04:11:32 PM »
I was about to ask does anyone know limit of (setq var1 value1 var2 value2 ... )? I know this can be simplified by separating setq-es, but just for an info...

I've successfully loaded lisp with 10MB size, containing 1000000 variables setq-ed in one line... So if I may conclude (setq) has no such issues with limitations... Note that in lisp that I used to create lisp (10MB) (load) function isn't quite thankful for checking... So as soon as first loop was over I terminated CAD and started it again when I used copy+paste method with lisp (10MB) into CAD interface for loading that setq... It was success and I still had to wait for loading 10MB lisp for a while... Here is my (c:testsetq) for creation of ttt.lsp (10MB), so that you can experiment on your own if you want, but I warn you if you have more important thing to do, please ignore this test...

Code: [Select]
(defun c:testsetq ( / f )
  (setq k 1000000)
  (while t
    (setq f (open "c:/SHARED FOLDER/ttt.lsp" "w"))
    (write-line "(eval (setq" f)
    (repeat (setq k (+ k 1000000))
      (write-line "a 1" f)
    )
    (write-line "))" f)
    (close f)
    (load "c:/SHARED FOLDER/ttt.lsp")
  )
)

P.S. "k" variable is global in order to be checked upon load failure (but this won't happen at least according to my testings)...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ur_naz

  • Newt
  • Posts: 68
  • Made in Ukraine
Re: Issues compiling to VLX
« Reply #14 on: November 25, 2016, 04:54:18 PM »
Making DCL on the fly is very bad idea.  :uglystupid2:

Support this assertion please.

Ok, if you write dynamic DCL you have to
1) Write more code and read much longer bumf;
2) Check  more errors and every slash around strings;
3) Check if DCL is created/exist/loaded. Some paranoiac antivirus software and latest versions of windows can prevent file I/O operations.
4) Rewrite your code every time then Autodesk fails with codepages...

« Last Edit: November 25, 2016, 04:57:59 PM by ur_naz »