Few lisps to improve workflow

Few lisps to improve workflow

Lukasvop1
Advocate Advocate
3,582 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,583 Views
48 Replies
  • Lisp
Replies (48)
Message 2 of 49

paullimapa
Mentor
Mentor

So what you are showing on the pictures with each of the command prompts (except the last one where you didn’t) is exactly the same sequence in a lisp file. I’ll give you one example and then you should be able to do the others. Here’s the one for Zoom Object :

(defun c:zo () ; this defines a function you can type at command prompt as zo
(command "_.zoom" "_o") ; surround response to each command prompt with quotes
) ; defun zo

 


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

Lukasvop1
Advocate
Advocate

Yes, I tried this, but it doesn't work right..

0 Likes
Message 4 of 49

paullimapa
Mentor
Mentor

Elaborate on what doesn’t work right


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

hak_vz
Advisor
Advisor

For multiple point  by using menus DRAW>POINT>MULTIPLE POINT or

if you want lisp than something like

 

(defun c:mpt(/ pnt)
  (while (setq pnt (getpoint "\nSpecify a point: "))(command "_.point" pnt))
  (princ)
)
(defun c:zo( / ss)
	(cond 
		((setq ss (last(ssgetfirst)))
			(command "_.zoom" "_O" ss "") 
		)
		(T
			(princ "\nSelect object(s) to zoom to > ")
			(command "_.zoom" "_O" (ssget) "")
		)
	)
	(princ)
)

 

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.
Message 6 of 49

Sea-Haven
Mentor
Mentor

Sq pt see attached

 

"Circle 3" is in built option to circle.

 

 

0 Likes
Message 7 of 49

Lukasvop1
Advocate
Advocate
Thank you
0 Likes
Message 8 of 49

Lukasvop1
Advocate
Advocate

"Circle 3" is in built option to circle.

No, there are options for "3 point circle" and "2 tangents and radius"

I asking for 3 tangents circle.

0 Likes
Message 9 of 49

Lukasvop1
Advocate
Advocate

Here I try explain :

 

0 Likes
Message 10 of 49

ВeekeeCZ
Consultant
Consultant

@Lukasvop1 wrote:

"Circle 3" is in built option to circle.

No, there are options for "3 point circle" and "2 tangents and radius"

I asking for 3 tangents circle.


 

It is, it's just a menu macro in ribbon

 

The lisp line looks like this. 

(command "_.circle" "_3p" "_tan" pause "_tan" pause "_tan" pause)

 

You really need to learn these basic customizations.

 

Message 11 of 49

Lukasvop1
Advocate
Advocate

Thank you, I don't know it work's like this, (I mean add "_" before command and pause after it).

 

Can you tell me why this doesn't work?

 

(defun c:LDN()
(command "-laydel" "_n")
(princ)
)

0 Likes
Message 12 of 49

Kent1Cooper
Consultant
Consultant

Your image is too hard to read, so I'm not positive about what you want in number 4, but maybe it's the (pf) [= perpendicular from] function defined >here<.

Kent Cooper, AIA
0 Likes
Message 13 of 49

Lukasvop1
Advocate
Advocate

Yes, perpendicular line.

I post video in Message 11.

 

I need last two lisps from list:

1. LDN - Laydel, Name
5. LTA - Line tangent

 

 

0 Likes
Message 14 of 49

ВeekeeCZ
Consultant
Consultant

@Lukasvop1 wrote:

Thank you, I don't know it work's like this, (I mean add "_" before command and pause after it).

 

Can you tell me why this doesn't work?

 

(defun c:LDN()

(initcommandversion)
(command "-laydel" "_n")
(princ)
)


 

Try it with (initcommandversion)

0 Likes
Message 15 of 49

Lukasvop1
Advocate
Advocate

Nothing changes, not working..

0 Likes
Message 16 of 49

hak_vz
Advisor
Advisor
Accepted solution

@Lukasvop1  Here you have C3T. 

 

If you like it press "accept solution button". Is this so hard to do?

 

 

 

(defun c:c3t (/ *error* LM:intersections a1 a2 a3 e1 e2 e3 p1 p2 p3 a b c s r cp)
	(defun *error* ( msg )
		(if (not (member msg '("Function cancelled" "quit / exit abort")))
			(princ (strcat "\nError: " msg))
		)
		(setvar 'cmdecho 1)
		(princ)
	)
	(defun LM:intersections ( ob1 ob2 mod / lst rtn )
		(if (and (vlax-method-applicable-p ob1 'intersectwith)
				 (vlax-method-applicable-p ob2 'intersectwith)
				 (setq lst (vlax-invoke ob1 'intersectwith ob2 mod))
			)
			(repeat (/ (length lst) 3)
				(setq rtn (cons (list (car lst) (cadr lst) (caddr lst)) rtn)
					  lst (cdddr lst)
				)
			)
		)
		(reverse rtn)
	)
	(setvar 'cmdecho 0)
	(setq
		a1 (car(entsel "\nSelect first tangent line >"))
		a2 (car(entsel "\nSelect second tangent line >"))
		a3 (car (entsel "\nSelect third tangent line >"))
	)
	(cond 
		((and a1 a2 a3)
			(mapcar 'set '(e1 e2 e3) (mapcar 'vlax-ename->vla-object (list a1 a2 a3))) 
			(setq 
				p1 (car(LM:intersections e1 e2 acextendnone))
				p2 (car(LM:intersections e2 e3 acextendnone))
				p3 (car(LM:intersections e3 e1 acextendnone))
				a (distance p1 p2)
				b (distance p2 p3)
				c (distance p3 p1)
				s (* 0.5 (+ a b c))
				r (sqrt (/ (* (- s a)(- s b)(- s c)) s))
			)
			(command "_.xline" "B" p1 p2 p3 "")
			(setq a1 (entlast))
			(setq e1 (vlax-ename->vla-object (entlast)))
			(command "_.xline" "B" p2 p1 p3 "")
			(setq a2 (entlast))
			(setq e2 (vlax-ename->vla-object (entlast)))
			(setq cp (car(LM:intersections e1 e2 acextendnone)))
			(command "_.circle" cp r)
			(command "_.erase" a1 a2 "")
		)
	)
	(setvar 'cmdecho 1)
	(princ)
)

 

 

 

 

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 17 of 49

Lukasvop1
Advocate
Advocate

Thank you, absolutely not a problem.

0 Likes
Message 18 of 49

Lukasvop1
Advocate
Advocate

Can you also check lisps :

1. LDN - Laydel, Name

5. LTA - Line tangent

 

They're explained in video.

0 Likes
Message 19 of 49

ВeekeeCZ
Consultant
Consultant

@hak_vz wrote:

@Lukasvop1  Here you have C3T. 

 

If you like it press "accept solution button". Is this so hard to do?

 


 

I think you scared the hell out of him so he marked your reply just to please your eyes. There's no way this would work.

 

eekeeCZ_0-1709555801809.png

 

0 Likes
Message 20 of 49

Lukasvop1
Advocate
Advocate

Nope, I just appreciate his work and effort.
I know how's feel when you work for someone try do it best you know and he doesn't care..

0 Likes