is it possible to start solidworks in "batchmode"? What I need is the
possiblility to generate a tif-file without user-interaction. I would like
to start it from the command line:
e.g. solidworks -execmacro gentif c:\assemblys\myassembly1.sldasm
where gentif e.g. maybe a macro that takes the parameter
":\assemblys\myassembly1.sldasm", opens this file, save as tif and leave
solidworks.
Is this only a nice idea or is this (or something similar) already possible
in solidworks?
ciao
Detlef
--
# Detlef Jockheck
Hi Flipper,
yes it looks so, but is it possible to start a vb automaticaly by starting
solidworks from the commandline!? Is there a convention that a vb-script is
started automatically when it's named autoexec or something similar?
ciao
Detlef
--
# Dipl. Ing. (FH) Detlef Jockheck
# to reply via email remove ".nospam" from adress
Actually there IS a command line parameter to run a macro while starting SW.
I got it from SW support last summer; I guess it is used to run journal
files. I used it to automate things, but goddamn.... I don't remember it!
Gotta search the old mails...
-h-
For example:
"C:\Program Files\SolidWorks\SLDWORKS.exe" /M "C:\MyMacro.swp"
Greg Wedeking
"Heikki Leivo" <heikki...@cadworks.fi> wrote in message
news:d4Fka.854$M47.4...@reader1.news.jippii.net...
> Flipper wrote:
>
>> a job for API with VBA
> Hi Flipper,
>
> yes it looks so, but is it possible to start a vb automaticaly by
> starting solidworks from the commandline!? Is there a convention that a
> vb-script is started automatically when it's named autoexec or something
> similar?
>
You can go at this the other way around if you like. When you connect to
Solidworks with a VB application (compiled to an .exe rather than a simple
macro - which you could run in command line mode) you can have the VB app
spawn Solidworks. That is the way I do batch conversion of files - but I
usually just run it after I open Solidworks anyway. The app only starts up
Solidworks if it is not already running - which is how all of the canned
examples in the API work anyway as far as I recall.
For reference - here is the code you use:
Dim swApp As Object
'
'
'...a bunch of startup code, then
'
Set swApp = CreateObject("SldWorks.Application") ' Attach to exising
SolidWorks session or start
' up a new
SolidWorks session in the background.
'
'
'...a bunch more code to crank through and convert stuff...
'
'
Set swApp = Nothing 'Closes Solidworks
If you wanted to have Solidworks actually become visible so you can see the
stuff going on, just insert this line after you create the swApp object:
swApp.Visible = True
The only thing I have noticed (which I'm sure is solveable) is that the
particular instance of Solidworks created by my app doesn't load any custom
Addin's I have added to Solidworks. I'm sure there is a way around that -
I just don't need it at this point as my Addin's are just for testing
purposes anyway.
--
Markus
"C:\Program Files\SolidWorks\sldworks.exe" /m "C:\...\macro.swp"
In my case, the macro launches an .exe I wrote to change some settings
based on the active doc type.
Sub main()
Shell ("C:\FUE\doc type watcher\doctype watcher2.exe")
End Sub
--
Dale Dunn
Design Engineer
www.jamestool.com