+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Senior Member shailujp's Avatar
    Computer Details
    shailujp's Computer Details
    Operating System:
    Windows 7 64 bit
    Computer:
    Dell Precision T1650
    RAM:
    16 GB
    Graphics:
    AMD FirePro V5900 (ATI FireGL)
    Monitor:
    Dell
    Discipline
    Mechanical
    shailujp's Discipline Details
    Occupation
    Designer
    Discipline
    Mechanical
    Details
    Machine design, Mould Design and general drafting work
    Using
    AutoCAD 2015
    Join Date
    Jun 2013
    Location
    Mumbai - India
    Posts
    167

    Default CONVERTPSTYLES using a script issue

    Registered forum members do not see this ad.

    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 ).

    Code:
     
    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
    Attached Images

  2. #2
    Full Member
    Using
    AutoCAD 2012
    Join Date
    Sep 2011
    Location
    Sweden
    Posts
    40

    Default

    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.
    Code:
    (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.
    Code:
    (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.

  3. #3
    Senior Member shailujp's Avatar
    Computer Details
    shailujp's Computer Details
    Operating System:
    Windows 7 64 bit
    Computer:
    Dell Precision T1650
    RAM:
    16 GB
    Graphics:
    AMD FirePro V5900 (ATI FireGL)
    Monitor:
    Dell
    Discipline
    Mechanical
    shailujp's Discipline Details
    Occupation
    Designer
    Discipline
    Mechanical
    Details
    Machine design, Mould Design and general drafting work
    Using
    AutoCAD 2015
    Join Date
    Jun 2013
    Location
    Mumbai - India
    Posts
    167

    Default

    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.

    Code:
     
    FOR %%V IN (C:\Myfolder\*.dwg) DO start "T" /w "C:\Program Files\AutoCAD 2008\acad.exe" %%V /b "FIXPSTYLE.scr"
    Last edited by shailujp; 28th Mar 2014 at 06:22 am.

  4. #4
    Senior Member shailujp's Avatar
    Computer Details
    shailujp's Computer Details
    Operating System:
    Windows 7 64 bit
    Computer:
    Dell Precision T1650
    RAM:
    16 GB
    Graphics:
    AMD FirePro V5900 (ATI FireGL)
    Monitor:
    Dell
    Discipline
    Mechanical
    shailujp's Discipline Details
    Occupation
    Designer
    Discipline
    Mechanical
    Details
    Machine design, Mould Design and general drafting work
    Using
    AutoCAD 2015
    Join Date
    Jun 2013
    Location
    Mumbai - India
    Posts
    167

    Default

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

  5. #5
    Forum Newbie
    Using
    Map 3D 2014
    Join Date
    Sep 2016
    Posts
    2

    Default

    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

  6. #6
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,720

    Default

    Why not
    Code:
    (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
    A man who never made mistakes never made anything

  7. #7
    Forum Newbie
    Using
    Map 3D 2014
    Join Date
    Sep 2016
    Posts
    2

    Idea Great

    Registered forum members do not see this ad.

    THANKS A LOT BIGAL!

    Quote Originally Posted by BIGAL View Post
    Why not
    Code:
    (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

Similar Threads

  1. script issue
    By cursedeye in forum The CUI, Hatches, Linetypes, Scripts & Macros
    Replies: 6
    Last Post: 3rd Aug 2012, 04:10 am
  2. Model scale / VP scale issue / Co-ordinates issue
    By Richard Radford in forum AutoCAD Beginners' Area
    Replies: 5
    Last Post: 26th Aug 2010, 11:16 am
  3. Script opening script
    By zera in forum AutoLISP, Visual LISP & DCL
    Replies: 7
    Last Post: 7th Jan 2010, 08:01 pm
  4. Batch Convertpstyles
    By Jhun Gonzalo in forum AutoCAD Drawing Management & Output
    Replies: 4
    Last Post: 13th Jul 2009, 11:28 am
  5. Sub script and Super script Text
    By edwin in forum AutoCAD Beginners' Area
    Replies: 2
    Last Post: 1st Aug 2007, 08:07 pm

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts