Help with consultant export routine - autolisp

Help with consultant export routine - autolisp

DC-MWA
Collaborator Collaborator
1,027 Views
8 Replies
Message 1 of 9

Help with consultant export routine - autolisp

DC-MWA
Collaborator
Collaborator

I have a routine we use for exporting aec drawings to simple cad to a specified folder.

I have couple things I would like to add but its beyond my expertise.

FIRST:

At he end it shows a message, I would like to remove the extra back slashes from the message.

Code:

(print (strcat "Drawing export to Acad2007 creating file named: <" file "> Complete!"))

Shows:

Drawing export to Acad2007 creating file named: <C:\\PROJECTS\\CAD-CONDOC\\CAD EXPORTS\\Drawing5.dwg> Complete!

Would Like:

Drawing export to Acad2007 creating file named: <C:\PROJECTS\CAD-CONDOC\CAD EXPORTS\Drawing5.dwg> Complete!

 

Also we have a block that we fill out the date and time attributes manually so we keep track of current base file exports between all consultants.

The block is called base version.dwg. The attributes are "DATE" and "TIME"

What we need is for the programt o look for the block, if located, fill in the above attributes using the current system date and time.

Thanks you in advance for your time and assistance.

Block is attached..

 

 

 

 

0 Likes
Accepted solutions (1)
1,028 Views
8 Replies
Replies (8)
Message 2 of 9

CADaSchtroumpf
Advisor
Advisor

Use (princ) than (print)

exemple:

(princ (strcat "Drawing Export to Acad2007 Creating file named: <" (getvar "DWGPREFIX") (getvar "DWGNAME") "> Complete! "))(prin1)

For your attrib, why do not use a field by default?

for date:

%<\AcVar Date \f "%x">%

for time:

%<\AcVar Date \f "h:mm:ss tt">%
0 Likes
Message 3 of 9

DC-MWA
Collaborator
Collaborator

I only want the date and time updated in block when I export. Is that possible using fields?

If so, how do I go about using the firlds to update the block when quick export routine is run?

0 Likes
Message 4 of 9

dbhunia
Advisor
Advisor

@DC-MWA wrote:

I only want the date and time updated in block when I export. Is that possible using fields?

If so, how do I go about using the firlds to update the block when quick export routine is run?


 

Hi,

 

For the above highlighted points I am updating your code (The code attached in your post "Cannot write to directory:??? autolisp").

 

Try this code.......

 

 

 


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes
Message 5 of 9

DC-MWA
Collaborator
Collaborator

This is perfect. Thanks you.

Now the problem I'm having I have two programs with similar code..

If I run the Quickpot.lsp first and then the QEXP.lsp, it causes the export to fail.

If I run the QEXP.lsp first then the Quickplot.lsp, it's fine.

 

I have attached both files.

0 Likes
Message 6 of 9

dbhunia
Advisor
Advisor

Hi

 

What is your requirements......

 

And give me 1 hour now I am at Doctor chamber...


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes
Message 7 of 9

DC-MWA
Collaborator
Collaborator

As I stated above.

the problem I'm having I have two programs with similar code.. Quckplot.lsp and QEXP.lsp.

 

If I run the Quickpot.lsp first and then the QEXP.lsp, it causes the QEXP.lsp to crash.

If I run the QEXP.lsp first then the Quickplot.lsp, it's fine.

0 Likes
Message 8 of 9

dbhunia
Advisor
Advisor
Accepted solution

@DC-MWA wrote:

As I stated above.

the problem I'm having I have two programs with similar code.. Quckplot.lsp and QEXP.lsp.

 

If I run the Quickpot.lsp first and then the QEXP.lsp, it causes the QEXP.lsp to crash.

If I run the QEXP.lsp first then the Quickplot.lsp, it's fine.


 

Hi,

 

In the 1st case (If I run the Quickpot.lsp first and then the QEXP.lsp, it causes the QEXP.lsp to crash.)

 

Whenever you run the "Quickpot.lsp" first it  creates the folder "Quick Plots" at the below path .... mailtioned in *.lsp file.

(vl-mkdir (strcat (strcat (getvar 'DWGPREFIX)) "\\Quick Plots"))

 

After that if you run the "QEXP.lsp" then in your code ......

 

(/= (vl-file-directory-p (strcat (getvar 'DWGPREFIX) "Quick Plots")) T) becomes "Nil" (because "Quick Plots" already exist there) so it does not executing "(vl-mkdir (strcat (strcat (getvar 'DWGPREFIX)) "\\CAD EXPORTS\\"))". Hence the code do not creating "CAD EXPORTS" folder .........    so you getting the error......(because your Export path in "file" variable containing the folder, but the folder "CAD EXPORTS" does not exist)

 

But if there is already "CAD EXPORTS" folder is present then you will not get any error ..........

 

 

In the 2nd case (If I run the QEXP.lsp first then the Quickplot.lsp, it's fine)

 

 

When  you run the "QEXP.lsp" then in your code 

 

(/= (vl-file-directory-p (strcat (getvar 'DWGPREFIX) "Quick Plots")) T) becomes "T" (because "Quick Plots" do not exist there) so it executing "(vl-mkdir (strcat (strcat (getvar 'DWGPREFIX)) "\\CAD EXPORTS\\"))".....Hence the code is creating "CAD EXPORTS" folder and you do not getting any error.........(because your Export path in "file" variable containing the folder, but the folder "CAD EXPORTS" exist)

 


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes
Message 9 of 9

DC-MWA
Collaborator
Collaborator

Thank you. 

0 Likes