I am trying to create a script to run with ScriptPro. As part of the script I am using the "SSX" command to select blocks which I wish to delete. After running the script the ScriptPro logfile tells me "C o m m a n d : s s x U n k n o w n c o m m a n d " S S X " ".
Is there an alternative to SSX in scripting? My script is below...
TILEMODE
0
ssx
B
"Superseded Datum"
ERASE
P
ZOOM
EXTENTS
TILEMODE
1
ssx
B
"Superseded Datum"
ERASE
P
-PURGE
B
"Superseded Datum"
N
-PURGE
B
"Datum Shift"
N
-LAYER
M
"DATUM SHIFT"
-INSERT "P:\ESTATES\MERRIFIELD\Living to Business Park Datum Shift\Superseded Datum.dwg"
0,0
ZOOM
EXTENTS
QSAVE
Thanks,
Hi,
try to use lisp with (ssget ... instead, hope this works. I have not tried it, so it's more "I think it could work" 😉
_ERASE
(ssget "_X" '((0 . "INSERT")(2 . "YOUR BLOCKNAME")))
- alfred -
@Anonymous schrieb:
Is there an alternative to SSX in scripting? My script is below...
The problem is not your scripting, the problem is that the ssx function is not loaded -
so there is no command "SSX", -> unknown command
(SSX is part of EXPRESStool, not a native AutoCAD command)
But you can use it without re-writing your Script, the function is compatible with the ACC, but you need to load the program first!
Before u use the first time SSX in your script, add this line (as first or just one line befor your first ssx, no matter):
(load (findfile "ssx.lsp"))
Sebastian
Hi.
Thanks for the reply however the (load (findfile "ssx.lsp")) line did not work. I placed the code in the first line of the script. I also attempted to place the ssx.lsp file in the same folder as the accoreconsole.exe and included the complete path to ssx.lsp (i.e. (findfile "C:\\etc\\etc\\ssx.lsp")) but to no avail.
Any other suggestions?
Hi. Thanks for the reply. Could you please let me know if the code you provided can work directly in a *.scr file which is being used by ScriptPro or is there a header that needs to be included in the *.scr file which will allow ScriptPro to read this lisp code?
I have included your line and while it works as a cut and paste into the command line of AutoCAD, it doesn't work when trying to run it with Scriptpro.
"did not work"
And what is the problem?
Please show us the log from windows console and/or from the ACC Logfile.
If the Lisp can be found but doesn't load, check your secureload.
SSGET - NoProblem
Same thing, is your Script in a trustedpath?
https://help.autodesk.com/view/ACD/2020/ENU/?guid=GUID-2FB4611D-F141-48D5-9B6E-460EB59351AF
Sebastian
Hi,
>> is there a header that needs to be included in the *.scr file
Nothing needed to be loaded, LISP is available from start on.
Only AutoCAD LT would not work with this, but then SSX also would not work.
>> it doesn't work when trying to run it with Scriptpro.
Means what? Does not select, or does not end the selection (sending an additional <ENTER>) ... what does the output show?
BTW, does it not work inside ScriptPro or also when you run the single script.
It may help if you show us the script, at least the lines before and after the "(ssget ..." line
- alfred -
I'll run though my process...
This is my script (Forum.scr) which includes the "load ssx" line you suggested...
(load (findfile "ssx.lsp"))
TILEMODE
0
ssx
B
"Superseded Datum"
ERASE
P
ZOOM
EXTENTS
TILEMODE
1
ssx
B
"Superseded Datum"
ERASE
P
-PURGE
B
"Superseded Datum"
N
-PURGE
B
"Datum Shift"
N
-LAYER
M
"DATUM SHIFT"
-INSERT "P:\ESTATES\MERRIFIELD\Living to Business Park Datum Shift\Superseded Datum.dwg"
0,0
ZOOM
EXTENTS
QSAVE
I load the script in Scriptpro using the accoreconsole.exe...
Status "Failed"
Log file displays...
Project file:
Drawing file: P:\ESTATES\MERRIFIELD BUSINESS PARK\06_Stage 6 (Previous Stage 4) - Innovation Drive\3130503ADa.dwg
Processed by Computer: VA-03-C202
User name : M.Derango
[ Status summary ]
Failed
Error while reading log file for P:\ESTATES\MERRIFIELD BUSINESS PARK\06_Stage 6 (Previous Stage 4) - Innovation Drive\3130503ADa.dwg
I guess this is a message from ScripPro,
with no informations for is.
In your script as first thing,
turn LOGFILEON
and if you like change the LOGFILEPATH.
So you can see what happen in this Autocad/ACC logfile.
Sebastian
You can't load the lisp file "ssx.lsp" in the core console, because it depends on "acetutil.arx" which could not be loaded in the core console.
What you can try is to replace the function "acet-str-format" in ssx.lsp with your own version, which does not need the acetutil.arx.
regards
Markus
It's all right, BUT a) you can load ssx and b) you can use ssx , regardless of the acet-str format problem.
That's why i wrote to the TO that it is working.
But i don't know why he can not load the ssx, so i ask for the logfile.
@m_latz schrieb:
You can't load the lisp file "ssx.lsp" in the core console,
That's wrong
because it depends on "acetutil.arx" which could not be loaded in the core console.
Nothing to do with the ssx.lsp load process
What you can try is to replace the function "acet-str-format" in ssx.lsp with your own version, which does not need the acetutil.arx.
It's correct, but the acet-str-format call is in Lisp, it breaks "the Lisp" - not the running script
and all what you want from ssx is done at this time: SSX created the last selectionset.
So: You can load AND USE ssx in a Script like the TO does.
Yes, quick&dirty but it works without problems in this case and if you are not able to help yourself (programming), why not.
Here is the log
----------------
--snip--
Befehl: ssx
Select object <None>:
Enter filter option [Block name/Color/Entity/Flag/LAyer/LType/Pick/Style/Thickness/Vector]: Color
>>Enter color number to add [?] <RETURN to remove>: 1
Current filter: ((62 . 1))
Enter filter option [Block name/Color/Entity/Flag/LAyer/LType/Pick/Style/Thickness/Vector]:
; Fehler: no function definition: ACET-STR-FORMAT
Befehl:
Befehl: _move
Objekte wählen: _p
2 gefunden
Objekte wählen:
Basispunkt oder [Verschiebung] <Verschiebung>: 0,0
Zweiten Punkt angeben oder <ersten Punkt der Verschiebung verwenden>: 1,0
Befehl: _qsave
Befehl: _quit
Befehl:
Sebastian
Hi.
I have added LOGFILEON etc to my script. I have tried to run ScriptPro again and have these results...
[ AutoCAD - Fri Mar 06 11:50:38 2020 ]----------------------------------------
Command: (load (findfile "ssx.lsp"))
Type "ssx" at a Command: prompt or
(ssx) at any object selection prompt.
Command: TILEMODE
Enter new value for TILEMODE <1>: 0
Regenerating layout.
Regenerating model - caching viewports.
Command: ssx
Select object <None>:
Enter filter option [Block name/Color/Entity/Flag/LAyer/LType/Pick/Style/Thickness/Vector]: B
>>Enter block name to add <RETURN to remove>: "Superseded Datum"
Current filter: ((2 . "Superseded Datum"))
Enter filter option [Block name/Color/Entity/Flag/LAyer/LType/Pick/Style/Thickness/Vector]:
; error: no function definition: ACET-STR-FORMAT
Command:
Command: ERASE
Select objects: P
3 found
1 was not in current space.
Select objects:
Command: ZOOM
Specify corner of window, enter a scale factor (nX or nXP), or
[All/Center/Dynamic/Extents/Previous/Scale/Window/Object] <real time>: EXTENTS
Regenerating model.
Command: TILEMODE
Enter new value for TILEMODE <0>: 1
Restoring cached viewports.
Command: ssx
Select object <None>:
Enter filter option [Block name/Color/Entity/Flag/LAyer/LType/Pick/Style/Thickness/Vector]: B
>>Enter block name to add <RETURN to remove>: "Superseded Datum"
Could you please let me know what to do about ; error: no function definition: ACET-STR-FORMAT
1. You can see: SSX loads and it is working!
The initial case is solved.
2. Like m.latz wrote: you can define your own ACET-STR-FORMAT
I am away from Acad, so i can not check how it must be.
Without checking a first try:
Add this line before you send the first SSX command:
(defun ACET-STR-FORMAT (str) str)
EDITED: (defun ACET-STR-FORMAT (str n) (strcat "\nFound: " (if n n "0")))
Sebastian
Thanks again for assisting with this issue.
1. I have included your new line of code in my script and while it works when I cut and paste the whole script in the AutoCAD command line, it does not appear to work with ScriptPro. The script (when it works) deletes existing instances of a block in both model and paperspace of a drawing then inserts a new version of the block in model space only. The log file results show the new line has been accepted when using Scriptpro (see below)...
2. I also seem to be getting a reduced sized log file. It does not save all the commands throughout the complete script (script is also attached). Is there a command which can extend the log file?
Thanks.
LOG FILE
[ AutoCAD - Tue Mar 10 15:16:53 2020 ]----------------------------------------
Command: (load (findfile "ssx.lsp"))
Type "ssx" at a Command: prompt or
(ssx) at any object selection prompt.
Command: TILEMODE
Enter new value for TILEMODE <1>: 0
Regenerating layout.
Regenerating model - caching viewports.
Command: (defun ACET-STR-FORMAT (str n) (strcat "\nFound: " (if n n "0")))
ACET-STR-FORMAT
Command: ssx
Select object <None>:
Enter filter option [Block name/Color/Entity/Flag/LAyer/LType/Pick/Style/Thickness/Vector]: B
>>Enter block name to add <RETURN to remove>: "Superseded Datum"
Current filter: ((2 . "Superseded Datum"))
Enter filter option [Block name/Color/Entity/Flag/LAyer/LType/Pick/Style/Thickness/Vector]:
Found: 1
Command:
Command: ERASE
Select objects: P
1 found
1 was not in current space.
Select objects:
Command: ZOOM
Specify corner of window, enter a scale factor (nX or nXP), or
[All/Center/Dynamic/Extents/Previous/Scale/Window/Object] <real time>: EXTENTS
Command: TILEMODE
Enter new value for TILEMODE <0>: 1
Restoring cached viewports.
Regenerating 4 modified entities.
Command: (defun ACET-STR-FORMAT (str n) (strcat "\nFound: " (if n n "0")))
ACET-STR-FORMAT
Command: ssx
Select object <None>:
Enter filter option [Block name/Color/Entity/Flag/LAyer/LType/Pick/Style/Thickness/Vector]: B
I know this is an old question, but try adding (load "acetutil") at the beginning of your script. I was getting errors when using the SSX command, but got no errors loading it. Once I did that, SSX worked as expected.
Can't find what you're looking for? Ask the community or share your knowledge.