Author Topic: DWG Batch Conversion with Lisp ?  (Read 3786 times)

0 Members and 2 Guests are viewing this topic.

domenicomaria

  • Swamp Rat
  • Posts: 724
Re: DWG Batch Conversion with Lisp ?
« Reply #90 on: February 20, 2024, 12:11:07 AM »
Try the <DOT> before the qsave to see if that helps.
Yes !
this is the solution. A simple DOT !
Now it works ! Finally !


however in the script
(if (tell) ... doesn't work ... tell is a variabile, not a function
while
(if tell ... works well
« Last Edit: February 20, 2024, 12:14:56 AM by domenicomaria »

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2135
  • class keyThumper<T>:ILazy<T>
Re: DWG Batch Conversion with Lisp ?
« Reply #91 on: February 20, 2024, 01:04:37 AM »
With that in mind, this is probably worth reading
https://help.autodesk.com/view/ACD/2024/ENU/?guid=GUID-D991386C-FBAA-4094-9FCB-AADD98ACD3EF

//-----
Good call John !
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

domenicomaria

  • Swamp Rat
  • Posts: 724
Re: DWG Batch Conversion with Lisp ?
« Reply #92 on: February 20, 2024, 01:07:07 AM »
and so, in conclusion of this very long discussion, we can conclude that
in the scripts for Accoreconsole it is certainly possible to use functions of the type
ENTLAST, SUBST, ENTMOD, ENTUPD, ENTMAKE ...

.. and that it is useful to remember that in the end
it is better to add the command "qsave" or "saveas"
preceded by a small but important "dot".

That's all.

As far as I'm concerned,
in order not to create confusion in the heads of the reader,
my posts can be removed by the administrator...

... because what I wrote in the previous lines summarizes everything.

I apologize for the mess I made ...

JohnK

  • Administrator
  • Seagull
  • Posts: 10633
Re: DWG Batch Conversion with Lisp ?
« Reply #93 on: February 20, 2024, 09:42:26 AM »
This morning, I verified my batch script can be called from AutoLisp. I knew this was possible, but I have never used it in this way because using AutoCAD as a scripting interface is a bad idea. However, I wanted to verify this because you choose to ignore my recommendations almost immediately--because you thought this was not possible with what I offered--instead of asking.

So, that's not all!
Exercise 1:
        Please find a "Thank you" in this thread.
Exercise 2:
        Please work on something, offer it to someone in need. Have them ignore you and then help them debug a thing that will NOT work as well as what you offered them without a "thank you".
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

domenicomaria

  • Swamp Rat
  • Posts: 724
Re: DWG Batch Conversion with Lisp ?
« Reply #94 on: February 21, 2024, 06:21:14 AM »
the problem in my opinion it's not gratitude...

In my opinion this happened:

I asked for a piece of bread

I was offered oranges, apples, kiwis of great quality

but I only needed a piece of bread

I wanted only to understand if with Accoreconsole
I could use functions like
ENTLAST, ENTGET, ASSOC, SUBST, ENTMOD, ENTUPD, ENTMAKE ...

etc...

This is what I just needed.

And to understand this, I did a TEST with some DWGs
containing only 1 entity of type TEXT

The ONLY answer I needed (the piece of bread) was :

<   Domenico you are very distracted!

You forgot to save the drawing!

You must add at the end of the SCRIPT

(command "_.qsave") !   >


That's all ...
... and it took around 90 posts and over 2000 views
to arrive at this simple solution.

So I say that I made a simple, stupid mistake forgetting to save the drawing.

But, (and don't get angry, please!)
it seems that here, the only distracted person,
it's not just me.

But also all the others who posted interventions
and all those who saw the posts!

And for what concerns the gratitude,
... yes, it is a very important thing.

And I'm grateful to TheSwamp,
because it almost always gives me the opportunity
to find solutions and understand new and interesting things.

And so I'm grateful, and I take this opportunity to say it:
"thank you !"
to all those who participate in the discussions
and in particular to the various gurus !

But in this case, there is no problem of gratitude.

But just a problem of not paying enough attention.

My first of all.

But not just only mine ...

...and don't get angry...
« Last Edit: February 21, 2024, 08:38:01 AM by domenicomaria »

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2135
  • class keyThumper<T>:ILazy<T>
Re: DWG Batch Conversion with Lisp ?
« Reply #95 on: February 21, 2024, 02:29:41 PM »
I can see many references to save and qsave in the code samples provided to you.


Your suggestion that you didn't know you had to save is nullified by your own comments:


>>>

For example
i want to save every DWG into the Acad 2000 version
preserving the original DWG in the original version

so after doing some things (zoom extents, purge ... and what I want)
I save it with the same name in the same version
and after
I save it in the acad 2000 verison
modifing the name adding to the original name,
the suffix "---[acad 2000]"

<<<<


however the code strictly necessary for the script is only that below :
Code - Auto/Visual Lisp: [Select]
  1.    (setenv "DefaultFormatForSave" "64")
  2.  
  3.    (vl-cmdf "_qsave")
  4.  
  5.    (setq curr-dwg-name (getvar "dwgname") )
  6.    (setq curr-full-dwg-name (strcat (getvar "dwgprefix")  curr-dwg-name) )
  7.  
  8.    (setq new-dwg-name      (strcat (vl-filename-base (getvar "dwgname") ) "---[ACAD-2000].dwg") )
  9.    (setq new-full-dwg-name (strcat (getvar "dwgprefix")  new-dwg-name) )
  10.  
  11.    (setenv "DefaultFormatForSave" "12")
  12.    
  13.    (if(findfile new-full-dwg-name )
  14.       (setq cmd-r (vl-cmdf "_save" new-full-dwg-name "y") )
  15.       (setq cmd-r (vl-cmdf "_save" new-full-dwg-name    ) )
  16.    )
  17.  
  18.    (setenv "DefaultFormatForSave" "64")




Unfortunately the goals of the topic changed several times throughout the discussion and it seems that the requirement to save a drawing after it is modified had slipped your mind.
« Last Edit: February 21, 2024, 02:33:11 PM by kdub_nz »
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

domenicomaria

  • Swamp Rat
  • Posts: 724
Re: DWG Batch Conversion with Lisp ?
« Reply #96 on: February 21, 2024, 09:57:48 PM »
it's clear that I knew that the dwg needed to be saved...
... I tried to justify myself ...