style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<pjfontes> wrote in messageI'll
href="news:6151725@discussion.autodesk.com">news:6151725@discussion.autodesk.com...
have to admit, I'm a little over my head as I'm more comfortable programming
in VBA. ACADE, LISP and API calls are new to me - hopefully someone at
Autodesk can help me out. The objective: I need to be able to draw a
Wire from one Node to another Node with Circuit Builder. There are cases where
using ace_cb_stretch_wire_connect can not accomplish what we need
because the _WIRESKIP=n value is not always static. Ok, no problem.. I can
start by using the wd_wire API call: (c:wd_wire (list 4 18) (list 4 12) nil )
Works great! But I'd like to be able to continue the theme of using nodes
rather than absolute coordinates. I took wd_wire one step further and had a
lisp routine created to get me the coordinates of a node. (see attached)
(c:wd_wire (c:findnode "TEST1")(c:findnode "TEST2") nil) This also works
perfect while testing it in an open circuit drawing with some randomly placed
nodes. However, when I use this command in ace_circuit_builder.xls I get an
error: Error: bad argument type: 2D/3D point: ("c:findnode" "F1" 0.0) I'm
guessing this has something to do with LISP rather than Circuit Builder but I
don't understand why (c:wd_wire (c:findnode "TEST1")(c:findnode "TEST2")
nil) works perfect when entered into the command prompt manually but not
when used as a command within Circuit Builder. Is this an issue with our
programming or is circuit builder limited to running (reliably) with only API
calls prefixed with "ace_cb_"? Any help would be greatly appreciated. PJF.
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<pjfontes> wrote in messageAttached
href="news:6152100@discussion.autodesk.com">news:6152100@discussion.autodesk.com...
is a screen shot of a test that I did using the wd_wire API call together with
the FindNode lisp program that we created. It works great.
I
did a cut/paste of that exact command into ace_circuit_builder.xls and it
echo'd this error:
Error: bad argument type: 2D/3D point: ("c:findnode"
"TEST1" 0.0)Unknown
The node names are "F1" and "F2" I get
this:
Error: bad argument type: 2D/3D point: ("c:findnode" "F1"
0.0)
Problem is that sometimes wires GFCT-A and GFCT-B are
not there so I can't paste in a circuit with 'loops' already in place OR use a
"_Wireskip=n". The root cause is that when you paste a circuit on top of a
circuit ACADE wont put 'loops' in where they are required...
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">this
evaluation of user lisp functions is not built in to Circuit Builder AcadE 2009
but is built into AcadE 2010. However, you can add a small function to 2009 to
get it to work. I've reproduced the function here -
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">
style="COLOR: #1f497d">(defun c:ace_cb_eval ( a / )
style="COLOR: #1f497d"> ; This API call can be encoded into the Circuit
Builder spreadsheet. ARX will pass string "a"
style="COLOR: #1f497d"> ; and this eval function will parse it, replace '
char with " char, and then evaluate/execute
style="COLOR: #1f497d"> ; it.
style="COLOR: #1f497d"> ; Example 1: (c:ace_cb_eval "(setq overloads
1)")
style="COLOR: #1f497d"> ; Example 2: (c:ace_cb_eval "(if (= overloads
1)(c:ace_cb_insym #xyz nil 'HOL22' #scl 8 nil))")
style="COLOR: #1f497d"> ; In example #2, note that the "HOL22" is shown as
'HOL22'
style="COLOR: #1f497d">
style="COLOR: #1f497d"> (if (AND a (/= a ""))
style="COLOR: #1f497d"> (progn
style="COLOR: #1f497d"> ; Replace any ' character
found in string with double quote " character
style="COLOR: #1f497d"> (setq a (wd_fr_txt_replace
a "'" "\"" nil))
style="COLOR: #1f497d"> (eval (read a)) ; evaluate
the lisp expression
style="COLOR: #1f497d"> ) )
style="COLOR: #1f497d"> (princ)
style="COLOR: #1f497d">)
size=2>
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">And
the syntax of the call in the spreadsheet needs to change somewhat. In the
spreadsheet change the line to the following –
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">(c:ace_cb_eval
"(c:wd_wire (c:findnode 'TEST1') (c:findnode 'TEST2')
nil)")
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Notice
the whole line is “wrapped” in this new small function. This runs the user
function and exposes the value it returns to Circuit Builder. And notice the
single quotes around your arguments for the findnode function instead of double
quotes.
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Hope
this helps,
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Pat
Murnen
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<pjfontes> wrote in messagePat,
href="news:6152577@discussion.autodesk.com">news:6152577@discussion.autodesk.com...
My apologies, I can understand how this can be confusing. F1 and F2 (or TEST1
and TEST2) are the CODE values of arbitrary ace_cb_marker_block's that I am
placing in the drawing. Their only purpose is to give the FindNode lisp
routine a coordinate; a start point and end point of a "wire". The reason I'm
using ace_cb_marker_block is to keep things consistent; circuit builder
appears to ignore any unused marker blocks (which is great) I will send you my
ace_circuit_builder.xls as well as our 'master template' later today with
clarification of exactly what we are trying to accomplish. Paul
F.