Author Topic: Issues compiling to VLX  (Read 5954 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 »

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Issues compiling to VLX
« Reply #15 on: November 25, 2016, 05:36:22 PM »
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...

I've been using the technique for 2 decades and none of the reasons you cite have ever been an issue. My experience is contrary to what you suggest -- coding overhead nominal and has more reliable and secure than shipping a companion dcl file or packaging one via the vlisp compiler (which doesn't encrypt packaged dcl). tl;dr: I've never had one of my users or customers report an issue. Not once.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

VovKa

  • Water Moccasin
  • Posts: 1631
  • Ukraine
Re: Issues compiling to VLX
« Reply #16 on: November 25, 2016, 07:14:51 PM »
You can add DCL to your VLX app. Making DCL on the fly is very bad idea.  :uglystupid2:
there could be issues with dcls
read here https://www.theswamp.org/index.php?topic=47908.msg541261#msg541261

ur_naz

  • Newt
  • Posts: 68
  • Made in Ukraine
Re: Issues compiling to VLX
« Reply #17 on: November 26, 2016, 09:20:54 AM »
You can add DCL to your VLX app. Making DCL on the fly is very bad idea.  :uglystupid2:
there could be issues with dcls
read here https://www.theswamp.org/index.php?topic=47908.msg541261#msg541261
Wow, multylanguage apps is realy butthurt... When you going to support multiple languages you have to make multiple
* menu
* prompts (in lisp)
* help system
Better way is to do all in English.

Then you have problem with codepages you may just translate codepage one to another. When revert back if need. When dialogs are in separate files it is much easier to do and not changes lisp staff.

When you want to rearrange DCL within LISP you need to rewrite LISP. It is hard to do, because DCL stored in separate strings. This is good chance to get error as result.

Finally, DCL in LISP seems very very ugly  :sick:

ribarm

  • Gator
  • Posts: 3279
  • Marko Ribar, architect
Re: Issues compiling to VLX
« Reply #18 on: November 26, 2016, 09:59:38 AM »
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).

(repeat 1) is behaving exactly like (progn)... Check for 255 lines and fails in VLIDE; check for 254 lines and it passes test...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Issues compiling to VLX
« Reply #19 on: November 26, 2016, 11:56:35 AM »
On "making dcl on the fly" ... maintaining code and packaging code are distinctly different activities. Both are easy, enjoyable -- fun even. My maintained code is miles from ugly. On the other hand packaged code does not get scrutinized for aesthetics but for reliability, robustness ease of distribution etc. But alas, I evangelize fruitlessly.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Issues compiling to VLX
« Reply #20 on: November 28, 2016, 10:13:20 AM »
Almost all of my dialogs are purpose built and centrally referenced from a network location, so there isn't much point in building them on the fly from code.  But as noted, any differences are mostly stylistic rather than technical.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

ur_naz

  • Newt
  • Posts: 68
  • Made in Ukraine
Re: Issues compiling to VLX
« Reply #21 on: November 29, 2016, 12:09:52 PM »
Almost all of my dialogs are purpose built and centrally referenced from a network location, so there isn't much point in building them on the fly from code.  But as noted, any differences are mostly stylistic rather than technical.

Using network is the worse than creating a dialogue on the fly, because the server may be down or any update have bugs. Then stop the work of an entire workgroup. In my opinion, it is best to install the application locally and to enable its users to update their own. You can also divide users into groups depending on their experience. More experienced users will be the first to try out new features of the application, test the application performance and send error reports. Thus, it can safely carry out testing of the new features and their implementation. Finally, most of user not need any updates.They may get angry when something suddenly changes in their usual work.