Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Transparent command

7 REPLIES 7
Reply
Message 1 of 8
Anonymous
283 Views, 7 Replies

Transparent command

Is there a way to make a custom command run transparently with the
normal apostrophe?
7 REPLIES 7
Message 2 of 8
Anonymous
in reply to: Anonymous

In the "defun" statement at the beginning of the Lisp routine (I assume it's
a Lisp routine), try changing it from (defun c:yourcommand ( )) to (defun
yourcommand ( )). In other words remove the c:, then to run the command
transparently enter the command name in parenthesis in AutoCAD.

-Edgetrimmer


"Bob Hable" wrote in message
news:3DC716B3.EEC8BDB5@ped-portland.com...
> Is there a way to make a custom command run transparently with the
> normal apostrophe?
>
Message 3 of 8
Anonymous
in reply to: Anonymous

No need to remove the c:

As long as the routine DOES NOT call the "Command" function, it should work.

I have a routine that I use ALL the time to select the point halfway between
two points. It's defuned as:

(defun c:midpick(/ pt1 pt2 pt3)
(setq pt1 (getpoint "Enter First Point: "))
(setq pt2 (getpoint "Enter Second Point: "))
(setq pt3 (polar p1 (angle p1 p2) (/ 2 (distance p1 p2)))
)


If the line command is active, keyin 'midpick. It prompts me for two points
and then returns p3 and draws the line FROM that point.

--

RDI

(remove the exclamation from the email address)

"Edgetrimmer" wrote in message
news:FCBC5D7E9FADBD2C5B8B56BB33EE27F0@in.WebX.maYIadrTaRb...
> In the "defun" statement at the beginning of the Lisp routine (I assume
it's
> a Lisp routine), try changing it from (defun c:yourcommand ( )) to (defun
> yourcommand ( )). In other words remove the c:, then to run the command
> transparently enter the command name in parenthesis in AutoCAD.
>
> -Edgetrimmer
>
>
> "Bob Hable" wrote in message
> news:3DC716B3.EEC8BDB5@ped-portland.com...
> > Is there a way to make a custom command run transparently with the
> > normal apostrophe?
> >
>
>
Message 4 of 8
Anonymous
in reply to: Anonymous

Thanks for teaching an old dog a new trick.

Regards,
Edgetrimmer
Message 5 of 8
Anonymous
in reply to: Anonymous

Of course that wont' work too well for 3d:
;;D. C. Broad, Jr.
(defun c:mpick ()
(mapcar '(lambda (a b) (/ (+ a b) 2.0))
(getpoint "\nFirst point: ")
(getpoint "\nSecond point: ")))

"rdi" wrote in message
news:AED44E4DD654375D4CAEFE52D82E9588@in.WebX.maYIadrTaRb...
> No need to remove the c:
>
> As long as the routine DOES NOT call the "Command" function, it should work.
>
> I have a routine that I use ALL the time to select the point halfway between
> two points. It's defuned as:
>
> (defun c:midpick(/ pt1 pt2 pt3)
> (setq pt1 (getpoint "Enter First Point: "))
> (setq pt2 (getpoint "Enter Second Point: "))
> (setq pt3 (polar p1 (angle p1 p2) (/ 2 (distance p1 p2)))
> )
>
>
> If the line command is active, keyin 'midpick. It prompts me for two points
> and then returns p3 and draws the line FROM that point.
>
> --
>
> RDI
>
> (remove the exclamation from the email address)
>
> "Edgetrimmer" wrote in message
> news:FCBC5D7E9FADBD2C5B8B56BB33EE27F0@in.WebX.maYIadrTaRb...
> > In the "defun" statement at the beginning of the Lisp routine (I assume
> it's
> > a Lisp routine), try changing it from (defun c:yourcommand ( )) to (defun
> > yourcommand ( )). In other words remove the c:, then to run the command
> > transparently enter the command name in parenthesis in AutoCAD.
> >
> > -Edgetrimmer
> >
> >
> > "Bob Hable" wrote in message
> > news:3DC716B3.EEC8BDB5@ped-portland.com...
> > > Is there a way to make a custom command run transparently with the
> > > normal apostrophe?
> > >
> >
> >
>
>
Message 6 of 8
Anonymous
in reply to: Anonymous

With the following code I can create the transparent command 'bb.
I am having a few problems though. I am not able to create
an alias for the transparent command.
This works:
(vlax-add-cmd "bb" 'bb "bb" 1)
This should work but does not:
(vlax-add-cmd "bb" 'anything "bb" 1)

Also, if I start the line command, use the transparent command 'bb and
get point "midPt", how can I get "midPt" to the line command as input
(after the transparent command ends)?

(defun bb()
(setq os (getvar "osmode"))
(setvar "osmode" 512)
(setq pt1 (getpoint "\nPoint One: "))
(setq pt2 (getpoint "\nPoint Two: "))
(setq ptMid (polar pt1 (angle pt1 pt2) (/ (distance pt1 pt2) 2.0) ))
(setvar "osmode" os)
)

(vl-load-com)
(vlax-add-cmd "bb" 'bb "bb" 1)




Bob Hable wrote:

> Is there a way to make a custom command run transparently with the
> normal apostrophe?
Message 7 of 8
Anonymous
in reply to: Anonymous

Does anybody have any example to see how to make a transparent command in
VisualLisp

Thankyou

--
Gustavo Guidi
g_e_guidi@yahoo.com.ar
Message 8 of 8
Anonymous
in reply to: Anonymous

On Mon, 26 May 2003 16:05:27 -0700, "Gustavo Guidi"
wrote:

>Does anybody have any example to see how to make a transparent command in
>VisualLisp

With AutoLISP, you can have any C: defined function operate
transparently as long as it does not contain a (command) function, and
is not called from another AutoLISP routine.

--

Regards,

Ian A. White, CPEng
ianwhite@wai.com.au
WAI Engineering
Sydney 2000
Australia

Ph: +61 418 203 229
Fax: +61 2 9622 0450
Home Page: www.wai.com.au

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost