- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have created the below script to automatically convert a drawing from stb to ctb.
However the command CONVERTPSTYLES always pops up a dialog box requiring a stoppage in the code just to press OK.
If there any way to make this command run silent? Not pop up a Dialog box?
Or is there an alternate way to convert a drawing that is using stb to ctb silently"
I have tried:
cmdeco 0
cmddia 0
variations of
(command "_.ConvertPStyles" _"Yes")
(command "_.ConvertPStyles" _"OK")
(command "ConvertPStyles")
defun STBtoCTB ()
(princ "\nSTBTOCTB----CHECKS PLOT SETTING FOR CTB...DONE\n")
;; Initialize a flag to check if any CTB assignment was made
(setq assignment-made nil)
;; Main function body
(if (= (getvar "PSTYLEMODE") 0) ; Check if the drawing is in STB mode
(progn
(setq oldcmdecho (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
;; Run CONVERTPSTYLES to switch to CTB
(command "ConvertPStyles")
;; Assign the specified CTB file to Model Space
(command "._-plot" "y" "model" "Plotter" "Tabloid" "inches" "l" "n" "e" "f" "CENTER" "y" "NewCTB.ctb" "y" "a" "n" "y" "n")
;; Set flag to indicate assignment was made
(setq assignment-made t)
;; Assign the specified CTB file to each Layout in Paper Space
(foreach layout (layoutlist)
(if (/= layout "Model") ; Skip the Model layout if listed
(progn
(setq oldcmdecho (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(command "._-plot" "y" layout "Plotter" "Tabloid" "inches" "l" "n" "e" "f" "CENTER" "y" "NEWctb.ctb" "y" "n" "y" "n" "n" "Y" "n")
(setvar "CMDECHO" oldcmdecho)
;; Set flag to indicate assignment was made
(setq assignment-made t)
)
)
)
;; Only display the message once if any assignment was made
(if assignment-made
(princ "\nThe drawing has been converted from STB to CTB and assigned the specified CTB file to both Model and Paper Space.\n")
)
)
;; Message for when no conversion is needed
(princ "The drawing is already using CTB plot styles. No conversion needed.\n")
)
)
AutoCAD 2024 (Mechanical, Electrical, Inventor)
VaultPRO 2024 (Vault Admin)
Inventor 2024 (Design, Factory, Simulate)
Solved! Go to Solution.