Jump to content

Recommended Posts

Posted

Hello,

 

I have some drawings that requires CONVERTPSTYLES run to be able to use the plot style .ctb files. Otherwise it shows missing.

 

So, I have created a script per below (btw my first script ever :)).

 

 
CONVERTPSTYLES
QSAVE
QUIT

 

This script works well if all the files in folder has the issue of missing plot style. If any one file is not having this issue, then the script stops. I noticed that the CONVERTPSTYLES is having two different responses and if the file does not have any issue, then it pops-up different window causing my script to stop.

 

The first image is the normal pop-up and once okayed. command closes for the problematic files (works perfectly).

 

Second image is the additional pop-up looking for some files when the file is having no issues.

 

Any suggestions

Capture1.PNG

Capture2.PNG

Posted

Hi shailujp,

 

First I will refer to the AutoCAD help:

A drawing can use either named or color-dependent plot styles, but not both.

CONVERTPSTYLES converts a currently open drawing from color-dependent plot styles to named plot styles, or from named plot styles to color-dependent plot styles, depending on which plot style method the drawing is currently using.

When you convert a drawing, CONVERTPSTYLES sets the
PSTYLEMODE
system variable to the appropriate setting (0 = named, 1= color-dependent).

For example, a drawing using color-dependent plot styles assigns plot properties to objects and layers by color. In other words, all objects with the same color have the same plot properties. CONVERTPSTYLES converts the drawing to use named plot styles that can be applied to objects or layers independent of color assignment. In other words, all objects with the same color can have different plot properties.

 

A script file is not built on conditions. You can´t write a script that checks if a line is blue and if it is then turn it red.

A script just turns it red, no matter what.

 

But if you write a lispfile you can set conditions.

 

The following code checks if the system variable PSTYLEMODE is 0 (Named plot style) and if it is, then it runs the command CONVERTPSTYLES otherwise it don´t.

(if (= (getvar "PSTYLEMODE") 0)
(command "convertpstyles")
)
(command "_.qsave")

 

 

If you want to load a lispfile from a scriptfile then you write like this in you´r scriptfile.

(load "c:\\temp\\lispfile.lsp")

 

Maybe it´s possible to eliminate the root of the problem rather than fixing it like this but I´m not that good with ctb and stb files.

Posted (edited)

Thank you ripuz.

 

Your suggestion worked for me. Now when I run this script, it goes smooth and no stopping whatsoever.

 

One more thing I learned about lisp today. I was under impression that LISP file must contain DEFUN but I was wrong.

 

Got one question on the batch file though. Currently I'm using below code for the batch file. I copy all my files-to-convert into this folder and run the utility. Is it possible to allow for selection of the folder so that I dont have copy/paste drawings to this folder? Or should I change the folder name inside batch each time? Just want to know how others do this?

 

Also, how to add multiple folders so that I can run this on say five different folder.

 

And if possible, can someone describe the functions listed under the batch code.

 

 
FOR %%V IN (C:\Myfolder\*.dwg) DO start "T" /w "C:\Program Files\AutoCAD 2008\acad.exe" %%V /b "FIXPSTYLE.scr"

Edited by shailujp
Posted

I have did some basic reading on some websites but couldnt find what START, "T" and /W stands for. Any clue?

  • 2 years later...
Posted

Hi to All.

 

excuse me but i don't see the Code,.

Do you can send it to me? ...or directly the lisp file.

 

Thanks a lot

Posted

Why not

(if (= (getvar "PSTYLEMODE") 0)
(setvar "Pstylesmode" 1)
)

 

You could use Lee-mac scriptwriter and run it all from inside Autocad, also use in a lisp FINDFILE and write a script so directory is not hard coded.

 

Me I would just use

CMD

cd\myfolder

Dir *.dwg > dirlst /b

open dirlist in word use Replace and script is done.

 

open dwg1 z e (if (= (getvar "PSTYLEMODE") 0) (setvar "Pstylesmode" 1)) qsave

open dwg2 z e (if (= (getvar "PSTYLEMODE") 0) (setvar "Pstylesmode" 1)) qsave

open dwg3 z e (if (= (getvar "PSTYLEMODE") 0) (setvar "Pstylesmode" 1)) qsave

Posted

THANKS A LOT BIGAL!:shock:

 

Why not

(if (= (getvar "PSTYLEMODE") 0)
(setvar "Pstylesmode" 1)
)

 

You could use Lee-mac scriptwriter and run it all from inside Autocad, also use in a lisp FINDFILE and write a script so directory is not hard coded.

 

Me I would just use

CMD

cd\myfolder

Dir *.dwg > dirlst /b

open dirlist in word use Replace and script is done.

 

open dwg1 z e (if (= (getvar "PSTYLEMODE") 0) (setvar "Pstylesmode" 1)) qsave

open dwg2 z e (if (= (getvar "PSTYLEMODE") 0) (setvar "Pstylesmode" 1)) qsave

open dwg3 z e (if (= (getvar "PSTYLEMODE") 0) (setvar "Pstylesmode" 1)) qsave

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...