Few lisps to improve workflow

Few lisps to improve workflow

Lukasvop1
Advocate Advocate
3,608 Views
48 Replies
Message 1 of 49

Few lisps to improve workflow

Lukasvop1
Advocate
Advocate

Hi guys, can you check this. I need create this few easy lisps separatly. Can you help?

 

1. LDN - Laydel, Name
2. MPT - Multiple Point
3. ZO - Zoom object
4. LP - Line perpendicular
5. LTA - Line tangent
6. C3T - tan, tan, tan

 

 

@komondormrex

Simple_lisps.png

 

0 Likes
3,609 Views
48 Replies
Replies (48)
Message 21 of 49

hak_vz
Advisor
Advisor

@ВeekeeCZ I updated the code in post that was accepted and it now works OK. I actually played with different approaches i.e. either to use vectors or simple intersections. Thanks for intervention. Sometime its not bad to have code with error since it then may force use to start learning autolisp.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 22 of 49

Kent1Cooper
Consultant
Consultant

@Lukasvop1 wrote:

.... I post video in Message 11. ....


[There is no video posted there.]

Kent Cooper, AIA
0 Likes
Message 23 of 49

Lukasvop1
Advocate
Advocate
Message 13 now.
0 Likes
Message 24 of 49

hak_vz
Advisor
Advisor

@Lukasvop1 

 Search older post for what you are looking for. I'm sure there must be something already posted on this forum. I'll play with LTA later.

 

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 25 of 49

Kent1Cooper
Consultant
Consultant
Accepted solution

I see a video at Message 9, if that's what you mean.  In that case, I think your LP could be done this way:

 

(defun c:LP ()
  (command "_.line" "_per")
  (prin1)
)

 

These requests all seem to be just putting simple command options into custom command definitions.  You can do that yourself, easily enough, following the examples.

 

The exception seems to be the LAYDEL one.  I tried starting with (initdia) to get the dialog-box list of Layer names to come up, but it still asks for a name at the command line.  And @ВeekeeCZ already suggested preceding the command with (initcommandversion), which you say didn't work.  So I didn't try it with that alone, but I tried both, and this worked for me:

 

(defun C:LDN ()
  (initdia)
  (initcommandversion)
  (command "_.laydel" "_name")
  (prin1)
)

 

Kent Cooper, AIA
0 Likes
Message 26 of 49

Lukasvop1
Advocate
Advocate
Yes, seems work right, thank you.
0 Likes
Message 27 of 49

paullimapa
Mentor
Mentor
Accepted solution

or go with the vla-sendcommand method:

(defun c:ldn (/ aec_sendkeys)
 (defun aec_sendkeys (cmd-arg)
 (vla-Sendcommand(vla-Get-ActiveDocument(vlax-Get-Acad-Object))cmd-arg)(princ)
 )
 (aec_SendKeys "_.Laydel _Name\n")
)

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 28 of 49

komondormrex
Mentor
Mentor

@Kent1Cooper wrote:

 

  (initdia)

 


has no sense since

Currently, the following commands make use of the initdia function: ATTDEF, ATTEXT, BHATCH, BLOCK, COLOR, IMAGE, IMAGEADJUST, INSERT, LAYER, LINETYPE, MTEXT, PLOT, RENAME, STYLE, TOOLBAR, and VIEW.

0 Likes
Message 29 of 49

komondormrex
Mentor
Mentor

hey there,

regarding item 4. are you in  need to draw a perpendicular from a certain point on a curve in either direction?

0 Likes
Message 30 of 49

stev98312
Enthusiast
Enthusiast

Because LAYDEL is an Express Tool.

Calling it from LISP the way you want may be a challenge.

I believe the OP wants to issue the command and be presented with window containing a list of layers he can then choose for LAYDEL to work on. That would be sweet, but none of my searches comes up with anything like that.

 

Steve

0 Likes
Message 31 of 49

Kent1Cooper
Consultant
Consultant

@komondormrex wrote:

@Kent1Cooper wrote:
  (initdia)

has no sense since

Currently, the following commands make use of the initdia function: ATTDEF, ATTEXT, BHATCH, BLOCK, COLOR, IMAGE, IMAGEADJUST, INSERT, LAYER, LINETYPE, MTEXT, PLOT, RENAME, STYLE, TOOLBAR, and VIEW.


You are correct.  I had not tried defining LDN with only (initcommandversion) because the OP said it didn't work.  So I simply tried it with both (initdia) and (initcommandversion) and it worked for me.  But now I've tried it with (initcommandversion) but not (initdia), and that also works for me.  So @Lukasvop1, can you be more specific about in what way that did not work for you?  How did you incorporate it?  I used "_.laydel" instead of the hyphen-prefixed "-laydel", if that is what makes the difference.

Kent Cooper, AIA
0 Likes
Message 32 of 49

Kent1Cooper
Consultant
Consultant

@stev98312 wrote:

Because LAYDEL is an Express Tool. ....


It may have been originally, but since at least Acad2020 [maybe earlier] it's been a "real" command that can be called in an AutoLisp (command) function.

Kent Cooper, AIA
0 Likes
Message 33 of 49

stev98312
Enthusiast
Enthusiast

Seems I spoke out of turn and without first reading the entire thread thoroughly.

The solution you provided in message 25 is working perfectly.

 

Steve

 

 

0 Likes
Message 34 of 49

Sea-Haven
Mentor
Mentor

For the circle inside a triangle needs code. Have a go or Google it may exist, I did not search.

 

How to Inscribe a Circle in a Triangle | Geometry | Study.com

 

 

0 Likes
Message 35 of 49

Lukasvop1
Advocate
Advocate

I try it with only (initcommandversion) and now works right. I had created alias called LDN and it was probbaly problem.

(defun C:LDN ()
(initcommandversion)
(command "_.laydel" "_n")
(prin1)
)

0 Likes
Message 36 of 49

Lukasvop1
Advocate
Advocate

Hi, can you check video in this topic, in MESSAGE 1.

I need only last one lisp 5. LTA - Line tangent

thank you

0 Likes
Message 37 of 49

Lukasvop1
Advocate
Advocate

Like @ВeekeeCZ said it's just a menu macro in ribbon..

 

Not necessary overcomplicate needed.

(defun c:C3T()
	(command "_.circle" "_3p" "_tan" pause "_tan" pause "_tan" pause)
	(princ)
)

 

0 Likes
Message 38 of 49

komondormrex
Mentor
Mentor

LTA option 1

 

(command "_line" "_tan" pause pause "")

 

LTA option 2

 

(command "_line" "_tan" pause "_tan" pause "")

 

0 Likes
Message 39 of 49

Lukasvop1
Advocate
Advocate

Thank you, is possible include both options in one lisp?

0 Likes
Message 40 of 49

komondormrex
Mentor
Mentor
Accepted solution

maybe like this 

(defun c:LTA (/ old_osmode)
	(setq old_osmode (getvar 'osmode))
	(setvar 'osmode 256)
	(command "_line" pause pause "")
	(setvar 'osmode old_osmode)
)

 

0 Likes