Lisp: double-quotes for Enter key in Bcad10
Upgrading from Bcad7 to Bcad10, my lisp code crashes when double-quotes are encountered (""). Anybody know a solution? Is there an alternate char for the Enter key? The code works fine in ver <= 7.
(if (or (= disch "U") (= disch "HR") (= disch "DR") (= disch "BH")) (command "mirror" "l" "" z1 (polar z1 (dtr 90) 5) "y"))
Comments
-
I cannot confirm this. Your code works fine in BC10.1.7 (trail). Of course your code does require the presence of a "Last" element in the drawing and a function dtr. Maybe your problem lies there.
0 -
That line just returns NIL when I cut and paste in V10.1.7
I have plenty of lisps which use "" as CR which all work fine.
I did have one in my on_doc_load which caused crashes on starting initially in the first V10. Took it out and no trouble since.
0 -
Roy - yes, I insert a block (w/o any attributes) just prior to that code, and yes dtr is a valid function..
(Defun dtr (a) (* pi (/ a 180.0)))
Hmm.. funny, when I disable that code line, the rest of the lisp continues to execute flawlessly. Here's the partial History C&P below. Btw, what does "Units: Unitless Conversion: 1.000" mean? Or do?
IcadCmd: insert? to list blocks in drawing/~ to open the file dialog/<Block to insert> <MTR-3>: C:/Bin6/ProUnit/Be12Units: Unitless Conversion: 1.000Multiple blocks/Scale/<Insertion point for block>: Corner/XYZ/X scale factor <1.000000>: Y scale factor: < Equal to X scale (1.000000)>: Rotation angle for block <0.000>: 180IcadCmd: mirrorSelect entities to mirror: lSelect entities to mirror: ; error : Function cancelled
0 -
I don't think you can put a lisp inside (command ...)
things like (command ... (...) ) don't always work
0 -
Brain: to exclude the block as a problem factor draw a line and then use this code:
(defun c:Mtest ( / )
(setq disch "U")
(setq z1 (getpoint "Pick mirror point: "))
(if (or (= disch "U") (= disch "HR") (= disch "DR") (= disch "BH")) (command "mirror" "l" "" z1 (polar z1 (dtr 90) 5) "y"))
)"Units: Unitless Conversion: 1.000" probably is related to the variable INSUNITS. Although I don't get this message even when INSUNITS of a block is different from the drawing.
0 -
Roy, I did as you suggested, the line mirrored without any problems. Next, I manually inserting the block in question, immediately followed by running your code again, and the block also mirrored without any problems.This now points to the insert command. Are there any significant differences in the Insert command between ver 7 and 10? Also, is the use of an asterisk still valid in the insert command? -
(command "insert" "*/somefolder/somepart" '(5 5) "" "")
I liked the new nick you gave me - Brain. I wish I could live up to it, though.
0 -
Brian, you are right: the asterisk is the problem.
;; (command "insert" "*/somefolder/somepart" '(5 5) "" "") ; strange but works in BC7
(command "insert" "somefolder/somepart2" '(5 5) "" "" "") ; works in BC7 and BC100 -
Roy, I beg to differ - the asterisk doesn't seem to be the problem, I tried both ways in B10, as you can see in the pasted history below. The asterisk only explodes the block after its inserted.
* <LispEx active> (c)2005-2009 BricsysIcadCmd: IcadCmd: IcadCmd: (command "insert" "/bin6/prounit/be22" '(0 0) "" "" "")IcadCmd: insert? to list blocks in drawing/~ to open the file dialog/<Block to insert>: /bin6/prounit/be22Units: Unitless Conversion: 1.000Multiple blocks/Scale/<Insertion point for block>: Corner/XYZ/X scale factor <1.000000>: Y scale factor: < Equal to X scale (1.000000)>: Rotation angle for block <0.000>: NILIcadCmd: '._ZOOMZoom: In/Out/All/Center/Extents/Left/Previous/Right/Scale/Window/<Scale (nX/nXP)>: _EIcadCmd: (command "insert" "*/bin6/prounit/be18" '(22 0) "" "")IcadCmd: insert? to list blocks in drawing/~ to open the file dialog/<Block to insert> <be22>: */bin6/prounit/be18Units: Unitless Conversion: 1.000Multiple blocks/Scale/<Insertion point for block>: Scale factor for block <1.0>: Rotation angle for block <0.000>: NIL
0 -
Brian maybe we are speaking about different versions. I am using Bricscad 10.1.7 build 16382 (Trial). I get:
: (command "insert" "*/somefolder/somepart2" '(5 5) "" "")
: insert
? to list blocks in drawing/~ to open the file dialog/<Block to insert>: */somefolder/somepart2
-- Could not find file \somefolder\somepart2. --
:
Opposite corner:
Invalid window specified.
Opposite corner:
Invalid window specified.
Opposite corner: NIL
:And I end up with a "sticky window" that I cannot get rid of. I have to close the BC-session.
Using the code without "*" I get:
: (command "insert" "somefolder/somepart2" '(5 5) "" "" "")
: insert
? to list blocks in drawing/~ to open the file dialog/<Block to insert>: somefolder/somepart2
Units: Meters Conversion: 39.3701
Multiple blocks/Scale/<Insertion point for block>:
Corner/XYZ/X scale factor <1.000000>:
Y scale factor: < Equal to X scale (1.000000)>:
Rotation angle for block <0>: NILThe lisp-code executes properly. BTW: I see that I do get: "Units: ... Conversion: ...".
0