Jump to content

Draw circle again


AIberto

Recommended Posts

Hi dear friend.

look:

t01.png

1 step. pick a line (or pline) ,Enter the Offset distance.

2 step. pick a line (or pline) ,Enter the Offset distance.

3 step. draw a circle with center line ,the layer name of center line is "cen"

4 step. Choose inside or outside

many thanks !

Edited by AIberto
Link to comment
Share on other sites

  • Replies 24
  • Created
  • Last Reply

Top Posters In This Topic

  • AIberto

    10

  • Tharwat

    9

  • highflybird

    4

  • Lee Mac

    1

Top Posters In This Topic

Posted Images

I can not see any difference between this thread and the previous one ?

 

Tharwat. It's difference .

 

tt.png

 

Not necessarily closed object , Not necessarily a polygon.

Not the same Offset distance .(d1 &d2),

Need two pick , (pick1 & pick2)

Link to comment
Share on other sites

Try this Alberto and let me know .

 

(defun c:Test (/ _line _screw s1 s2 l a p)
 ;;	Author: Tharwat		;;
 ;;	Date: 09.09.2014	;;
 (defun _line (p q)
   (entmakex (list '(0 . "LINE") (cons 8 "cen") (cons 62 4) (cons 10 p) (cons 11 q)))
 )
 (defun _screw (pt r)
   (mapcar '(lambda (p)
              (entmakex (list '(0 . "CIRCLE") (cons 10 p) (cons 40 r)))
              (_line (polar p 0. (* r 1.2)) (polar p pi (* r 1.2)))
              (_line (polar p (* pi 1.5) (* r 1.2)) (polar p (* pi 0.5) (* r 1.2)))
            )
           (list pt)
   )
 )
 (while (and (setq s1 (entsel "\n Pick Left side line :"))
             (wcmatch (cdr (assoc 0 (entget (car s1)))) "LINE,LWPOLYLINE")
             (setq s2 (entsel "\n Pick Right side line :"))
             (wcmatch (cdr (assoc 0 (entget (car s2)))) "LINE,LWPOLYLINE")
             (setq p (getpoint "\n Specify Corner point of the two side [intersection] :"))
             (setq *dist1* (cond ((getdist (strcat "\n Specify Left distance < "
                                                   (rtos (if *dist1*
                                                           *dist1*
                                                           (setq *dist1* 1.0)
                                                         )
                                                         2
                                                         2
                                                   )
                                                   " > :"
                                           )
                                  )
                                 )
                                 (*dist1*)
                           )
             )
             (setq *dist2* (cond ((getdist (strcat "\n Specify Right distance < "
                                                   (rtos (if *dist2*
                                                           *dist2*
                                                           (setq *dist2* 1.0)
                                                         )
                                                         2
                                                         2
                                                   )
                                                   " > :"
                                           )
                                  )
                                 )
                                 (*dist2*)
                           )
             )
             (setq *rad* (cond ((getdist (strcat "\n Diameter of Circle < "
                                                 (rtos (if *rad*
                                                         *rad*
                                                         (setq *rad* 1.0)
                                                       )
                                                       2
                                                       2
                                                 )
                                                 " > :"
                                         )
                                )
                               )
                               (*rad*)
                         )
             )
        )
   (progn (setq l (mapcar 'vlax-curve-getclosestpointto (list (car s1) (car s2)) (list (cadr s1) (cadr s2)))
                a (mapcar 'angle (list p p) (list (car l) (cadr l)))
          )
          (_screw (polar (polar p (car a) *dist2*) (cadr a) *dist1*) (/ *rad* 2.))
   )
 )
 (princ)
)(vl-load-com)

Edited by Tharwat
Link to comment
Share on other sites

Try this Alberto and let me know .

 

NOTE: I have highlighted in Blue the radius of circle in the routine , so you can change it to suit your needs if you want to .

 

 

Thanks very much ! Tharwat. :thumbsup:

I am so sorry! :cry: sorry! I didn't say clear .

I want Enter radius of circle by routine ,Rather than a fixed value.

Link to comment
Share on other sites

Thanks very much ! Tharwat. :thumbsup:

I am so sorry! :cry: sorry! I didn't say clear .

I want Enter radius of circle by routine ,Rather than a fixed value.

 

Not a problem , I modified the routine , try and let me know .

 

NOTE: if you want to cancel the process of the program , just hit Enter or the space bar which is better than Esc button and to avoid error message .

Link to comment
Share on other sites

Not a problem , I modified the routine , try and let me know .

 

NOTE: if you want to cancel the process of the program , just hit Enter or the space bar which is better than Esc button and to avoid error message .

 

Thank you !masters Tharwat.

I have a small request .

I need Enter the diameter of circle, not Radius.

I need the layer of centre line is "cen"

 

gradation can change ?

1.Pick left side line

2.Pick right side line

3.Specify a point on the Corner

4.Specify Left distance

5.Specify Right distance

7.Enter diameter of Circle

Link to comment
Share on other sites

Thank you !masters Tharwat.

I have a small request .

I need Enter the diameter of circle, not Radius.

I need the layer of centre line is "cen"

 

gradation can change ?

1.Pick left side line

2.Pick right side line

3.Specify a point on the Corner

4.Specify Left distance

5.Specify Right distance

7.Enter diameter of Circle

 

Modified again HERE.

Link to comment
Share on other sites

Hello, Tharwat.

Long time no see ! You are still so enthusiastic !

Good routine! A little advice .

Why need specify intersection point ? Two line intersection point , Can't calculate?

Link to comment
Share on other sites

Hello, Tharwat.

Long time no see ! You are still so enthusiastic !

 

Hi ,

I am here all the time , but you might be not enthusiastic to participate with us in here :P

 

Why need specify intersection point ? Two line intersection point , Can't calculate?

 

Okay , I made mine quickly at the first glance and it does not hurt with one more step from a user ;)

Eager to see your try in this regard .

Link to comment
Share on other sites

This should work as you may have indicated to if the two objects are lines or polylines or then one polyline ;)

 

(setq p (vlax-invoke (vlax-ename->vla-object (car s1)) 'intersectwith (vlax-ename->vla-object (car s2)) Acextendboth))

Link to comment
Share on other sites

This should work as you may have indicated to if the two objects are lines or polylines or then one polyline ;)

 

(setq p (vlax-invoke (vlax-ename->vla-object (car s1)) 'intersectwith (vlax-ename->vla-object (car s2)) Acextendboth))

 

Haha, you know I don't understand programming .:(, Have a headache .

Link to comment
Share on other sites

Why need specify intersection point ? Two line intersection point , Can't calculate?

A good idea. thanks

 

This should work as you may have indicated to if the two objects are lines or polylines or then one polyline

 

(setq p (vlax-invoke (vlax-ename->vla-object (car s1)) 'intersectwith (vlax-ename->vla-object (car s2)) Acextendboth))

 

can be achieved ? Tharwat. can you modify it ? This can save a step . Thanks.

Link to comment
Share on other sites

Haha, you know I don't understand programming .:(, Have a headache .

 

Not a problem , I did not know before that the vla-intersectwith function can get the corner of two segments of a polyline , so that why I went that way as before , but now I have modified the routine with the new changes . :)

 

A good idea. thanks

can be achieved ? Tharwat. can you modify it ? This can save a step . Thanks.

 

Already done :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...