Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

solidworks in batchmode?

1,718 views
Skip to first unread message

Detlef Jockheck

unread,
Apr 7, 2003, 7:11:12 AM4/7/03
to
Hi,

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

Flipper

unread,
Apr 8, 2003, 11:13:34 AM4/8/03
to
a job for API with VBA

Detlef Jockheck

unread,
Apr 8, 2003, 1:24:27 PM4/8/03
to
Flipper wrote:

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

Heikki Leivo

unread,
Apr 8, 2003, 3:05:41 PM4/8/03
to
> 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

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-


Greg Wedeking

unread,
Apr 8, 2003, 3:26:30 PM4/8/03
to
The command line parameter is /M

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

Markus Wankus

unread,
Apr 8, 2003, 7:22:32 PM4/8/03
to
On Tue, 08 Apr 2003 19:24:27 +0200, Detlef Jockheck
<detlef...@jockheck.de> wrote:

> 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

Dale Dunn

unread,
Apr 8, 2003, 8:33:31 PM4/8/03
to
Use the /m switch:

"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

Ondřej Suchomel

unread,
Feb 13, 2023, 2:27:52 AM2/13/23
to
Hi, can I do this :

"C:\Program Files\SolidWorks\sldworks.exe" /m "C:\...\macro.swp"

without launching new instance of SolidWorks?


0 new messages