Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Not sure how to do this...

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
Anonymous
1162 Views, 9 Replies

Not sure how to do this...

Hi, so I have a working C++ program which creates a SCR file which I have to manually insert into the DWG file.

How can I apply the SCR file automatically to the DWG file?

9 REPLIES 9
Message 2 of 10
dlanorh
in reply to: Anonymous

What is the SCR file? Normally SCR files are script files (lists of autocad commands) that need to be run, not inserted.

I am not one of the robots you're looking for

Message 3 of 10
Anonymous
in reply to: dlanorh

the the SCR is a list of insert commands which has the location of the block and the vector to insert it in the the dwg.
what to insert and where is controled
by the program.
Message 4 of 10
JustoAg
in reply to: Anonymous

You could try any of this:
- From the C++ program, try to open a new AutoCAD with the scr file as a command line parameter, use /b.
- From AutoCAD use the SCRIPT command'
- From AutoCAD run a lisp routine to invoque the script command as the last thing.
- From AutoCAD use a SHELL command to run the C++ progr and then the Script command.
 
Regards.
Message 5 of 10
Anonymous
in reply to: JustoAg

Thanks, the first option is the easiest for my opinion, I didnt know that I can open a new dwg and run scr as it opens...

Could you give me a code example or link to a tutorial video?
Message 6 of 10
cadffm
in reply to: Anonymous

http://help.autodesk.com/view/ACD/2019/ENU/?guid=GUID-CE4A928E-FDB1-470A-8176-32ABD1E3C6A1

and links below. You need parameter /s "d:/mypath/myscript.scr"

For batchjobs is accoreconsole.exe interesting, but who works with it must know a few things more. The safe simple method is the acad.exe or tools like scriptpro.

Sebastian

Message 7 of 10
Anonymous
in reply to: cadffm

Thak you, I got the idea. I'm not a programmer, I'm just a lazy electrical engeener so I dont know many tools, just the basics, I learn on the go...
Message 8 of 10
JustoAg
in reply to: Anonymous

Maybe possible with something like ShellExecute(NULL, "open", "path\\to\\acad.exe", NULL, NULL, SW_SHOWDEFAULT);

There are other methods more complicated with COM interfaces, IAcadApplication and so. Try to use it at the end of your c++ code. 

The command line parameter is /b (former /s), it seems they changed it at some point.

Message 9 of 10
cadffm
in reply to: JustoAg

No it was ever /b in my remember.
Sorry, misspelled in the hustle, but in my link it's perfectly documented.

Why I wrote the wrong one because for the accoreconsole.exe the switch is really / s

Sebastian

Message 10 of 10
JustoAg
in reply to: cadffm

You're right. It was always /b to run a script.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report