What i mistake ?

What i mistake ?

jaimuthu
Advocate Advocate
1,182 Views
15 Replies
Message 1 of 16

What i mistake ?

jaimuthu
Advocate
Advocate

(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)

0 Likes
Accepted solutions (4)
1,183 Views
15 Replies
Replies (15)
Message 2 of 16

ВeekeeCZ
Consultant
Consultant

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

 

eekeeCZ_0-1727982290340.png

 

0 Likes
Message 3 of 16

jaimuthu
Advocate
Advocate

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 

0 Likes
Message 4 of 16

ec-cad
Collaborator
Collaborator

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

 

 

 

ECCAD

Message 5 of 16

ВeekeeCZ
Consultant
Consultant

you need use this line

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

 

0 Likes
Message 6 of 16

ec-cad
Collaborator
Collaborator

No,

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

 

 

0 Likes
Message 7 of 16

ec-cad
Collaborator
Collaborator

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

 

0 Likes
Message 8 of 16

ec-cad
Collaborator
Collaborator
Accepted solution

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

 

0 Likes
Message 9 of 16

jaimuthu
Advocate
Advocate
Thank For Your Reply its work Good its possible Any degree ?
0 Likes
Message 10 of 16

ec-cad
Collaborator
Collaborator
Accepted solution

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

0 Likes
Message 11 of 16

ec-cad
Collaborator
Collaborator

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

0 Likes
Message 12 of 16

ec-cad
Collaborator
Collaborator
Accepted solution

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

0 Likes
Message 13 of 16

ec-cad
Collaborator
Collaborator

Here's the 3 drawing block.

 

ECCAD

0 Likes
Message 14 of 16

ec-cad
Collaborator
Collaborator
Accepted solution

Jaimuthu,

Please see messages 12 & 13.

 

ECCAD

0 Likes
Message 15 of 16

jaimuthu
Advocate
Advocate

Great Thanks for Your Response its work fine

0 Likes
Message 16 of 16

ec-cad
Collaborator
Collaborator

You are very welcome !

Thanks for the feedback.

 

ECCAD

0 Likes