Python SendCommand PLOT convert to jpeg

Python SendCommand PLOT convert to jpeg

Anonymous
Not applicable
1,330 Views
2 Replies
Message 1 of 3

Python SendCommand PLOT convert to jpeg

Anonymous
Not applicable

Hi,

I am using python to convert dwg to jpeg. 

Currently, I am using SendCommand and "_-PLOT" to convert to jpg:

 

acad = win32com.client.dynamic.Dispatch("AutoCAD.Application")
doc = acad.ActiveDocument

doc.SendCommand('_-PLOT ' 'T \n' 'Model \n' 'plotter_ARD\n' +str(size)+'\n' 'Pionowo\n' 'Nie\n' 'Zakres\n' 'Dopasuj\n' '\n' 'Nie\n' '.\n'  'Tak\n' '\n' 'N\n' 'T\n')

 

everything works correctly, but there is a file dialog in the end:

file_dialog.jpg

I would like to fill it without pyautogui. Is there a way to fill it with python AutoCAD libraries?

0 Likes
1,331 Views
2 Replies
Replies (2)
Message 2 of 3

cadffm
Consultant
Consultant

@Anonymous  schrieb:

Is there a way to fill it with python AutoCAD libraries?


Change the content of your sendcommand (you can built a Lisp-Statement as string and send this to the commandline)

 

I am not familiar with the phyton syntax for string handling,

my mother language is german, not english or polski,

but the result (in AutopCAD) should looks like this:

(command "_.-PLOT" "_yes" "Model" "plotter_ARD" "YourPaperSizeNameHere" "Pionowo" "Nie" "Zakres" "Dopasuj" "" "Nie" "." "Tak" "" "Nie" "Tak")

The whole line AS ONE STRING, 1:1 as i post it incl. the ""

 

OR: Set FILEDIA to 0 first, plot, set Filedia back to the previous value.

 

 

Sebastian

0 Likes
Message 3 of 3

Anonymous
Not applicable

Thank you for your answer!

 

I set FILEDIA to 0 and now I can set directory in CommandLine. 

 

0 Likes