Help calling geomcalc from lisp

Help calling geomcalc from lisp

Anonymous
Not applicable
473 Views
10 Replies
Message 1 of 11

Help calling geomcalc from lisp

Anonymous
Not applicable
Hello Everyone,
I have a line in a lisp the uses the calculator.
(setq pt5 (c:cal
"plt(pt2,pt3,0.5)"))
If I manually load the "cal" before I run it, it works. If I don't I get
this
error;

.*** ERROR : too many arguments

So I put (arxload "c:/program files/ACAD2000/geomcal.arx") in the
acad2000.lsp
file to be sure it was loaded.
Now everytime I open another drawing I see "arxload failed" (because its
already
loaded). Can someone tell me the proper way to handle this?

Thanks

Randy
0 Likes
474 Views
10 Replies
Replies (10)
Message 2 of 11

Anonymous
Not applicable
Mr. Smeghead,

Personally, I would not rely upon the command line calculator. LISP is rich
with calculations within itself that should be sufficient for what you are
trying to do.

--
Eugene N. Kilmer
Owner/Mag Drafting
0 Likes
Message 3 of 11

Anonymous
Not applicable
Hi, Smeghead
I'm using similar lisp routine and it works well.
Please see bellows.
I'm sure this is what you looking for.

;;;;;; Loading "geomcal.arx" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun Load_cal ( / file_dia)
(if (not cal)
(progn
(setq file_dia (getvar "filedia"))
(setvar "filedia" 0)
(if (not (findfile "geomcal.arx"))
(prompt "\n Not found 'geomcal.arx' and '_cal command will be not to
work.")
(progn
;(command "appload" "C:\Program Files\ACAD2000\SUPPORT\geomcal.arx")
(command "_arx" "Load" "geomcal.arx")
(setvar "filedia" file_dia)
) ) ) )
(princ)
)

;;;;;; _offset+'cal ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun C:offcal ( / Distanc)
(Load_cal)
(command "_offset")
(setq Distanc (cal))
(command Distanc)
(princ)
)

Smeghead ÀÌ(°¡) <[email protected]> ¸Þ½ÃÁö¿¡¼­
ÀÛ¼ºÇÏ¿´½À´Ï´Ù...
>Hello Everyone,
> I have a line in a lisp the uses the
calculator.
>(setq pt5 (c:cal
>"plt(pt2,pt3,0.5)"))
>If I manually load the "cal" before I run it, it works. If I don't I get
>this
>error;
>
>.*** ERROR : too many arguments
>
>
>So I put (arxload "c:/program files/ACAD2000/geomcal.arx") in the
>acad2000.lsp
>file to be sure it was loaded.
>Now everytime I open another drawing I see "arxload failed" (because its
>already
>loaded). Can someone tell me the proper way to handle this?
>
>Thanks
>
>Randy
>
>
0 Likes
Message 4 of 11

Anonymous
Not applicable
Middle of two end points (mee). To find the center of a rectangle and place
a hole of proper size based on rectangle width and height. I did notice a
middle point of a line routine in the tutorial , utilities.lsp. I'll give it
a try, thanks.
Eugene N. Kilmer wrote in message <[email protected]>...
>Mr. Smeghead,
>
>Personally, I would not rely upon the command line calculator. LISP is
rich
>with calculations within itself that should be sufficient for what you are
>trying to do.
>
>--
>Eugene N. Kilmer
>Owner/Mag Drafting
>
0 Likes
Message 5 of 11

Anonymous
Not applicable
There are many ways to avoid this crash. The quick and dirty woul be:

(arxload "c:/program files/ACAD2000/geomcal.arx" 1)

More proper would be checking, if c:cal is already loaded:

(if (/= (type c:cal) 'EXRXSUBR)
(progn
(setq res (arxload "c:/program files/ACAD2000/geomcal.arx" 1))
(if (= res 1)
(prompt "\nCouldn't load calculator arx")
)
)
)

--
Alex Januszkiewicz
Intelcad Systems and 911 DWG Recovery Services
<>
*Check out our DWF => DWG converter*
** New free ObjectARX downloads coming soon**

--

Smeghead wrote in message
news:[email protected]...
> Hello Everyone,
> I have a line in a lisp the uses the
calculator.
> (setq pt5 (c:cal
> "plt(pt2,pt3,0.5)"))
> If I manually load the "cal" before I run it, it works. If I don't I get
> this
> error;
>
> .*** ERROR : too many arguments
>
>
> So I put (arxload "c:/program files/ACAD2000/geomcal.arx") in the
> acad2000.lsp
> file to be sure it was loaded.
> Now everytime I open another drawing I see "arxload failed" (because its
> already
> loaded). Can someone tell me the proper way to handle this?
>
> Thanks
>
> Randy
>
>
0 Likes
Message 6 of 11

Anonymous
Not applicable
Hi "Smeghead",

I have nothing to contribute to the issue you raise, other than the fun of
saying "Hi Smeghead" which is your chosen newsgroup name, but which is
generally thought of as a rude insult, at least in the UK, and perhaps in
the USA, where we watch Red Dwarf and other British comedies rich in "smeg"
connotations.

Mark McDonough
[email protected]

Smeghead wrote in message <[email protected]>...
>Hello Everyone,
> I have a line in a lisp the uses the
calculator.
>(setq pt5 (c:cal
>"plt(pt2,pt3,0.5)"))
>If I manually load the "cal" before I run it, it works. If I don't I get
>this
>error;
>
>.*** ERROR : too many arguments
>
>
>So I put (arxload "c:/program files/ACAD2000/geomcal.arx") in the
>acad2000.lsp
>file to be sure it was loaded.
>Now everytime I open another drawing I see "arxload failed" (because its
>already
>loaded). Can someone tell me the proper way to handle this?
>
>Thanks
>
>Randy
>
>
0 Likes
Message 7 of 11

Anonymous
Not applicable
"Smeghead",

You don't need to use the Geometry Calculator for such a simple AutoLISP
Calc:

(setq p3 (polar p1 (angle p1 p2) (/ (distance p1 p2) 2)))

OR:

(setq p3 (MapCar '(Lambda (x1 x2) (/ (+ x1 x2) 2)) p1 p2))

--
Phillip Kenewell
CAD Systems Technician
Air Gage Company
[email protected]
===================
> Not < a Member of the AutoDESK
Discussion Forum Moderator Program

Smeghead wrote in message
news:[email protected]...
> Hello Everyone,
> I have a line in a lisp the uses the
calculator.
> (setq pt5 (c:cal
> "plt(pt2,pt3,0.5)"))
> If I manually load the "cal" before I run it, it works. If I don't I get
> this
> error;
>
> .*** ERROR : too many arguments
>
>
> So I put (arxload "c:/program files/ACAD2000/geomcal.arx") in the
> acad2000.lsp
> file to be sure it was loaded.
> Now everytime I open another drawing I see "arxload failed" (because its
> already
> loaded). Can someone tell me the proper way to handle this?
>
> Thanks
>
> Randy
>
>
0 Likes
Message 8 of 11

Anonymous
Not applicable
Would this code be more efficient?

(if (not (member "geomcal.arx" (arx)))
(arxload "c:/program files/ACAD2000/geomcal.arx" "Couldn't load calculator
arx")
)

Alex Januszkiewicz wrote in message
<[email protected]>...
>There are many ways to avoid this crash. The quick and dirty woul be:
>
> (arxload "c:/program files/ACAD2000/geomcal.arx" 1)
>
>More proper would be checking, if c:cal is already loaded:
>
>(if (/= (type c:cal) 'EXRXSUBR)
> (progn
> (setq res (arxload "c:/program files/ACAD2000/geomcal.arx" 1))
> (if (= res 1)
> (prompt "\nCouldn't load calculator arx")
> )
> )
>)
>
>--
> Alex Januszkiewicz
>Intelcad Systems and 911 DWG Recovery Services
> <>
> *Check out our DWF => DWG converter*
>** New free ObjectARX downloads coming soon**
>
>
>
>--
>
>Smeghead wrote in message
>news:[email protected]...
>> Hello Everyone,
>> I have a line in a lisp the uses the
>calculator.
>> (setq pt5 (c:cal
>> "plt(pt2,pt3,0.5)"))
>> If I manually load the "cal" before I run it, it works. If I don't I get
>> this
>> error;
>>
>> .*** ERROR : too many arguments
>>
>>
>> So I put (arxload "c:/program files/ACAD2000/geomcal.arx") in the
>> acad2000.lsp
>> file to be sure it was loaded.
>> Now everytime I open another drawing I see "arxload failed" (because its
>> already
>> loaded). Can someone tell me the proper way to handle this?
>>
>> Thanks
>>
>> Randy
>>
>>
>
>
0 Likes
Message 9 of 11

Anonymous
Not applicable
Mark McDonough wrote in message
news:[email protected]...
> Hi "Smeghead",
>
> ...other than the fun of
> saying "Hi Smeghead" which is your chosen newsgroup name, but which is
> generally thought of as a rude insult, at least in the UK, and perhaps in
> the USA, where we watch Red Dwarf ...
>
i'm (being a transplanted Texican) unfamiliar with the term "smeg..."
_except_ as used on Red Dwarf, which i enjoy at least as much as
HitchHiker's Guide to the Universe; while we're drifting, i wonder if any of
our Russian readers can affirm whether the composer Moussorgsky's name has
the same general connotation as smeghead?
[a rumor i heard, and no offense intended -- he's one of my favorites, too.]

randy benson (in arabic, randy son-of-a-son).
0 Likes
Message 10 of 11

Anonymous
Not applicable
You guys fixed me up, thanks. I see that I don't need the calculator but I
was so used to using 'cal ; mee that thats the only way I could think.

Randy
0 Likes
Message 11 of 11

Anonymous
Not applicable
It probably would, but it would not print the message unless it's the last
statement in the lisp file.

I would say, it's rather a matter of preference then efficiency, as you
would need to load 10000 files to catch measurable difference (say 1 sec?)
I usually concentrate my efforts in areas, where significant improvements
can be achieved by proper coding (iterations would be one of them). I can
make my first shot a bit tighter:

(if (/= (type c:cal) 'EXRXSUBR)
(if (= 1 (arxload "c:/program files/ACAD2000/geomcal.arx" 1))
(prompt "\nCouldn't load calculator arx")
)
)

I admit: I'm careless about efficiency of these particular code fragments,
as long as they properly load the program and trap possible error.

--
Alex Januszkiewicz
Intelcad Systems and 911 DWG Recovery Services
<>
*Check out our DWF => DWG converter*
** New free ObjectARX downloads coming soon**

--

Mark E. Fretty wrote in message
news:[email protected]...
> Would this code be more efficient?
>
> (if (not (member "geomcal.arx" (arx)))
> (arxload "c:/program files/ACAD2000/geomcal.arx" "Couldn't load
calculator
> arx")
> )
>
> Alex Januszkiewicz wrote in message
> <[email protected]>...
> >There are many ways to avoid this crash. The quick and dirty woul be:
> >
> > (arxload "c:/program files/ACAD2000/geomcal.arx" 1)
> >
> >More proper would be checking, if c:cal is already loaded:
> >
> >(if (/= (type c:cal) 'EXRXSUBR)
> > (progn
> > (setq res (arxload "c:/program files/ACAD2000/geomcal.arx" 1))
> > (if (= res 1)
> > (prompt "\nCouldn't load calculator arx")
> > )
> > )
> >)
> >
> >--
> > Alex Januszkiewicz
> >Intelcad Systems and 911 DWG Recovery Services
> > <>
> > *Check out our DWF => DWG converter*
> >** New free ObjectARX downloads coming soon**
> >
> >
> >
> >--
> >
> >Smeghead wrote in message
> >news:[email protected]...
> >> Hello Everyone,
> >> I have a line in a lisp the uses the
> >calculator.
> >> (setq pt5 (c:cal
> >> "plt(pt2,pt3,0.5)"))
> >> If I manually load the "cal" before I run it, it works. If I don't I
get
> >> this
> >> error;
> >>
> >> .*** ERROR : too many arguments
> >>
> >>
> >> So I put (arxload "c:/program files/ACAD2000/geomcal.arx") in the
> >> acad2000.lsp
> >> file to be sure it was loaded.
> >> Now everytime I open another drawing I see "arxload failed" (because
its
> >> already
> >> loaded). Can someone tell me the proper way to handle this?
> >>
> >> Thanks
> >>
> >> Randy
> >>
> >>
> >
> >
>
>
0 Likes