TheSwamp
CAD Forums => CAD General => Topic started by: CAB on November 23, 2004, 03:53:53 PM
-
I have the following script and it misses the ENTER after change all.
The next input is _p instead of Enter.
Any idea why?
; OPTICADD library file repair
; change block dwg layers to zero & move objects to 0,0 base point
; purge un-needed data
;;
Zoom
_e
_cutclip
all
_pasteclip
0,0
Zoom
_e
_change
all
<---<< Error here
_p
_la
0
clayer
0
_purge
A
*
n
_purge
A
*
n
_purge
A
*
n
-
Not sure, CAB...
I just ran it and had no errors at all.
; OPTICADD library file repair
; change block dwg layers to zero & move objects to 0,0 base point
; purge un-needed data
;;
Zoom
_e
_cutclip
all
_pasteclip
0,0
Zoom
_e
_change
all
_p
_la
0
clayer
0
_purge
A
*
n
_purge
A
*
n
_purge
A
*
n
I had created one much like this, but not exactly the same...
The one item I had on my wishlist was the current basepoint. I wish there was a way (and I'm sure there is in LISP) to check what the current basepoint is, then move the objects from wherever the current basepoint is to 0,0,0. Then, change the basepoint to 0,0,0.
(sorry to go off topic, but I wanted to add that...:oops: ;) )
-
Not sure what you mean by "Current Base Point".
I thought that when a drawing is inserted as a block that 0,0 was
always used as the base point.
-
Hi
Take a look at the system variable INSBASE
CAB, your above script also worked for me when tested.
Have a good one, Mike
-
Here is the script log, see error below.
Is ther another way to add ENTER, like ^M or something
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Project name: OptiFixBlk.scp
Local path: C:\Program Files\ACAD2000\
UNC path: \\ALAN\CALAN\PROGRAM FILES\ACAD2000\
Drawing name: ABIDET01.DWG
Local path: C:\OPTI\LIBRARY\MPFIXTUR\
UNC path: \\ALAN\CALAN\OPTI\LIBRARY\MPFIXTUR\
Processed by Computer: ALAN
User name: Alan
[ Status summary ]-------------------------------------------------------------
[ AutoCAD - Sun Nov 21 18:19:49 2004 ]----------------------------------------
Opening an AutoCAD 2000 format file.
Regenerating model.
CDG Change Case loaded - type "CDGCASE" to run
Command:
CDG Purge 3.0 loaded
"CDGPURGE" - dialog interface
"-CDGPURGE" - command line interface
Command:
AutoCAD Express Tools Copyright © 2000 Autodesk, Inc.
Offset Loaded. Enter OFS to run.
SlideDisplay.LSP for AutoCAD is loaded.
To view a slide one of the following commands:
WCS=Window Call Sizes VSF=Fraction/Decimal Chart
ACADSet_Variables has set system variables to your preset values.
AutoCAD menu utilities loaded.
AutoCAD menu utilities loaded. DDMODIFY loaded.
CDG Change Case loaded - type "CDGCASE" to run
CDG Purge 3.0 loaded
"CDGPURGE" - dialog interface
"-CDGPURGE" - command line interface
Command: (load "scriptpro.lsp")
Command: (acet-script-run "C:/PROGRAM FILES/ACAD2000/OP_BLK_FIX.SCR" T)
Pre-processing script...Done_.script
Enter script file name <C:\OPTI\LIBRARY\MPFIXTUR\ABIDET01.scr>: C:\DOCUME~1\ALAN\LOCALS~1\TEMP\SCRIPTPRO440.SCR
Command:
Command: Zoom
Specify corner of window, enter a scale factor (nX or nXP), or
[All/Center/Dynamic/Extents/Previous/Scale/Window] <real time>: _e
Command: _cutclip
Select objects: all
11 found
Select objects:
Command: _pasteclip
Specify insertion point: 0,0
Command: Zoom
Specify corner of window, enter a scale factor (nX or nXP), or
[All/Center/Dynamic/Extents/Previous/Scale/Window] <real time>: _e
Regenerating model.
Command: _change
Select objects: all
11 found
Select objects: _p <<<========<<<<<< Error Here
No previous selection set.
Select objects: _la
1 found (1 duplicate), 11 total
Select objects: 0
Specify opposite corner: clayer
Invalid window specification.
Select objects: Specify opposite corner: 0 found
Select objects: *Cancel*
Command: *Cancel*
Command:
DOSLib Version 6.1.4 (Feb 12 2004)
Copyright © 1992-2004, Robert McNeel & Associates
Plot2000 - www.plot2000.com
Plot2000 loaded. Commands are: PLOT2000CONFIG, BATCHPLOT, OKTEST!
Command: *Cancel*
Command:
Backup file:
C:\OPTI\LIBRARY\MPFIXTUR\ABIDET01.bak
renamed and saved as:
C:\OPTI\LIBRARY\MPFIXTUR\ABIDET01.bk1
-
Here is the script log, see error below.
Is ther another way to add ENTER, like ^M or something
Hi
You can use spaces (makes it a little more difficult to read) -
; OPTICADD library file repair
; change block dwg layers to zero & move objects to 0,0 base point
; purge un-needed data
;;
Zoom
_e
_cutclip
all
_pasteclip
0,0
Zoom
_e
_change all _p _la 0 clayer 0
_purge
A
*
n
_purge
A
*
n
_purge
A
*
n
<Blank Line Here>
Have a good one, Mike
-
Not sure what you mean by "Current Base Point".
I thought that when a drawing is inserted as a block that 0,0 was
always used as the base point.
Many of the blocks that were created here came from a drawing. Someone would be creating a drawing and as they created symbols, they WBlocked them out as they needed them.
If that symbol happened to be somewhere in the middle of the drawing, (let's say the bottom, left corner of the symbol is at 140,75,0), that's what the base point of the block is when you go to open the dwg file OF the block.
That being said, I'd like to maintain the "relative base point" (bottom, left corner of the block), but move it to 0,0,0.
It's kind of hard to explain, but how was that? Does it make sense? :)
-
I am not totally sure off of the top of my head but if you create a wblock and change the coordinates in the wblock dialog box to 0,0 it may always save that current insertion point that you picked on relavant to 0. Does that make sense?
That principal applies when you are creaing attributes:
Title Block at 0,0. create your attributes, wblock, pick point, change coords to 0,0. Then if you reinsert the attributes (block) it will remember the picked point relevant to 0
Mark
-
Mark
I think you hit it there.
If you wblock a block the insert point is used and the block is inserted at 0,0 & exploded.
Where as if you wblock objects you are allowed to pick the insert point but the default point
is 0,0 so the objects can be saved in the new drawing not at 0,0 but at the coordinates picked.
To move them to 0,0 in the new drawing there is no insert point unless it is still a block.
So M-dub if you new drawing contains a block you want to move it using the insert point as the
first move point and 0,0 as the destination. I'm don't know of a way outside of lisp to grab
the block by the insert point.
-
On my script problem,
I moved the code from my script file to a lisp and traded
one problem for another. :(
The routine stops on the EXPLODE Last command and I tried (entlast)
any thoughts?
Here is the LOG file:
Command: _cutclip
Select objects: all 20 found
Select objects:
Command: _pasteclip Specify insertion point: 0,0
Command: -insert Enter block name or [?] <A$C1D044463>: c:/opti/library/mpfixtur/_blocktag.dwg
Specify insertion point or [Scale/X/Y/Z/Rotate/PScale/PX/PY/PZ/PRotate]: 0,0
Enter X scale factor, specify opposite corner, or [Corner/XYZ] <1>: 1
Enter Y scale factor <use X scale factor>:
Specify rotation angle <0.0000>:
Command: _explode
Select object:
Command: OP_FIX_BLK Unknown command "OP_FIX_BLK". Press F1 for help.
Command: _Zoom
Specify corner of window, enter a scale factor (nX or nXP), or
[All/Center/Dynamic/Extents/Previous/Scale/Window] <real time>: _e Regenerating model.
; OPTICADD library file repair
; change block dwg layers to zero & move objects to 0,0 base point
; purge un-needed data
;;
(defun c:op_fix_blk()
(command "clayer" "0") ; current layer to 0
(command "._-layer" "Color" 2 "0" "" ) ; 0 to color yellow
;; all objects to layer 0
(command "_change" "all" "" "_p" "_la" "0" "")
(command "_Zoom" "_e")
(command "_cutclip" "all" ""); obj to clip board
(command "_pasteclip" "0,0") ; paste them to 0,0 with lower left as ref point
;; add a insert referance point and text for title of drawing
(COMMAND "-insert" "c:/opti/library/mpfixtur/_blocktag.dwg" "0,0" "1" "" "")
(command "_explode" "L" "") ; get rid of the "INSERT"
(command "_Zoom" "_e") ; frame objects in screen
(command "_purge" "A" "*" "n" ; remove all unnecessary items
"_purge" "A" "*" "n"
"_purge" "A" "*" "n")
(princ)
;; You must edit title text and adjust insert point if needed
;; before making a slide. Then delete the text & insert point indicator
;; before saving the drawing, drawing is now ready for use as a block
)
-
If you use 'cutclip', then autocad uses the lowerleft point of all the objects. If there are objects outsite the drawing the objects are moved outsite the limits. I should use 'copybase':
; OPTICADD library file repair
; change block dwg layers to zero & move objects to 0,0 base point
; purge un-needed data
;;
(defun c:op_fix_blk ()
(command "._-layer" "S" "0" "Color" 2 "0" "" ) ; current layer to 0 with layer color yellow
(command "_change" "all" "" "_p" "_la" "0" "")
(command "_Zoom" "_e")
(command "_copybase" "0,0" "all" ""); obj to clip board
(command "_erase" "all" "")
(command "_pasteclip" "0,0") ; paste them to 0,0 with lower left as ref point
(COMMAND "-insert" "*c:/opti/library/mpfixtur/_blocktag.dwg" "0,0" "1" "" ""); explode insert
(command "_Zoom" "_e") ; frame objects in screen
(repeat 3 (command "_purge" "A" "*" "n")) ; remove all unnecessary items
(princ)
;; You must edit title text and adjust insert point if needed
;; before making a slide. Then delete the text & insert point indicator
;; before saving the drawing, drawing is now ready for use as a block
)
But I don't know what you're trying to accomplish. If you want to remove nul objects, you can better do this (pseudo-code):
[Get layer settings]
[All layers on/thawn/unlocked]
(command "._regen")
(command "._zoom" "E")
(command "._zoom" "Vmax")
(command "._erase" "all" "r" "c" (getvar "VSMIN") (getvar "VSMAX") "")
[restore layer settings]
[edit]removed the yellow color[/edit]
-
It's pretty hard to read yellow text.
-
Yeh that text is awful,would be good if some moderator changed it.
-
If you use 'cutclip', then autocad uses the lowerleft point of all the objects.
If there are objects outsite the drawing the objects are moved outsite the limits. I should use 'copybase':
But I don't know what you're trying to accomplish. If you want to remove nul objects, you can better do this (pseudo-code):
Well if you read all the comments in the code you well see what I am trying to accomplish.
These block drawings have no frozen or off layers. So the thing I want to accomplish is
to change all objects to layer zero & move them so the lower left IS 0,0 & purge all.
You bring up a good point about the LIMITS. I insert a tag block at 0,0 and part of that
block is below 0,0 that may explain the error, although when I run th code in outside
ScriptPro there is no error. I'll check it out anyway.
Thanks
-
Yeh that text is awful,would be good if some moderator changed it.
I'd change it but I can't on this forum. He is most likely using a darker background
to view this board and it looked fine to him. We often overlook the fact that others
use different board styles to view messages when we choose colors. So using the Quote
and Code feature is often a better choice to high lite something.
-
Got it working.
Turns out the explode command did not need the ""
So it only took 2 days to work out my first script. :shock:
Hope I get better on the next one. 8)
CAB
-
Why don't you use
(COMMAND "insert" "*c:/opti/library/mpfixtur/_blocktag.dwg" "0,0" "1" "" "")
Then you don't have to explode at all!
-
Good idea, Thanks.