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

What i mistake ?

15 REPLIES 15
SOLVED
Reply
Message 1 of 16
jaimuthu
765 Views, 15 Replies

What i mistake ?

(defun c:PIEL ()

(setq pt1 (getpoint "\nPick the first point: "))
(setq pt2 (getpoint pt1 "\nPick the second point: "))
(setq pt3 (getpoint pt2 "\nPick the third point (90 degrees): "))


(setq an (* (/ 180 pi) (angle pt2 pt3)))


(command "_.PLINE" pt1 pt2 "")


(command "_.PLINE" pt2 pt3 "")


(command "_.INSERT" "JAI" pt2 1.0 1.0 0)

(setq obj1(entlast))



(princ (strcat "\nRotation angle: " (rtos an 2 2)))
)

(princ)

15 REPLIES 15
Message 2 of 16
ВeekeeCZ
in reply to: jaimuthu

The question is, which rotation do you want to use? There are two options:

 

eekeeCZ_0-1727982290340.png

 

Message 3 of 16
jaimuthu
in reply to: ВeekeeCZ

i want  i pick p1 p2 p3  block object insert and angle is p2 p3  its work only one direction its an angle is 0 but other wise its insert but angle its opposite direction dont want dynamic action  its just i test for block 

Message 4 of 16
ec-cad
in reply to: jaimuthu

Tried simple change, didn't work, removed the 'code'

 

 

 

ECCAD

Message 5 of 16
ВeekeeCZ
in reply to: jaimuthu

you need use this line

(command "_.INSERT" "JAI" pt2 1.0 1.0 (+ an 90))

 

Message 6 of 16
ec-cad
in reply to: ec-cad

No,

That's just not right. Works for all but pt2 / pt3 going right to left ?

 

 

Message 7 of 16
ec-cad
in reply to: jaimuthu

Looks like I'll have to check the direction of both plines.

The are 16 combinations of which way they are applied.

But in any case, the elbow needs to be at 0 or 180 it looks like.

I'll try a little later, lunch is ready.

 

ECCAD

 

Message 8 of 16
ec-cad
in reply to: jaimuthu

OK, I got it working.

Attached is the Lisp and the sample drawing, with notes.

Seems that there were only 8 combinations of those pline connections,

since pt3 can only be 'perp' to pt2, 0, 90, 180 or 270.

Anyway, have fun with it.

 

Cheers

 

ECCAD

 

Message 9 of 16
jaimuthu
in reply to: ec-cad

Thank For Your Reply its work Good its possible Any degree ?
Message 10 of 16
ec-cad
in reply to: jaimuthu

I am sure that can be done, with pline 1 (any angle), and 'type' of elbow, e.g. 30 / 45 / 90 or 

whatever they come in standard angles. You would have to provide the various blocks for

the elbows ..

The way it would work is:

1 - getpoints pt1, pt2 - any direction.

2 - would ask for what type of elbow.

3 - based on the answer, would ask for a 3 rd point pt3 for 'general' direction

3.1 - Optionally, ask for Length of 2nd pipe.

4 - based on general direction from pt2 to pt3, would calculate a (polar) point / angle for drawing

      the 2nd pline - based on degrees of elbow and distance.

5 - would then apply 2nd pline pt2 to pt3, and set in the elbow, rotated to suit.

 

Do you think that's a solution ?

 

ECCAD

Message 11 of 16
ec-cad
in reply to: jaimuthu

Are you using all PVC fittings ? They come in 22.5, 45 and 90 as far as I can see on the web.

Can you upload a drawing with all the blocks you will have to use ?

 

ECCAD

Message 12 of 16
ec-cad
in reply to: ec-cad

Attached is a Lisp to try out. Does 22.5 / 45 / 90 degree Elbows at any Angle.

Crude blocks also attached.

You need to make your own blocks similar to attached, and edit the Lisp

to set your 'path' to where your blocks are located, or place them in a \support

folder, and edit the (command "_insert" (strcat path blk) pt2 "1" "1" rot) line to be:

(command "_insert" blk pt2 "1" "1" rot)

 

The Web site won't allow more than (3) attachments, so I'll attach the 90ELBOW to another

response.

 

ECCAD

Message 13 of 16
ec-cad
in reply to: ec-cad

Here's the 3 drawing block.

 

ECCAD

Message 14 of 16
ec-cad
in reply to: jaimuthu

Jaimuthu,

Please see messages 12 & 13.

 

ECCAD

Message 15 of 16
jaimuthu
in reply to: ec-cad

Great Thanks for Your Response its work fine

Message 16 of 16
ec-cad
in reply to: jaimuthu

You are very welcome !

Thanks for the feedback.

 

ECCAD

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report