Jump to content

Recommended Posts

Posted

Hello again friends ‼‼
I attach an explanatory image.
I would like to place a text (a green number 2 in the image) at a certain distance from the vertex of the Poly.
If the Azimuth of both lines are known, through a Routine, how do I find out the Average Azimuth of those 2 Lines, to be able to position the green text 2 at a certain distance from the vertex❓❓
Thanks in advance friends ‼‼‼‼

bbbbbbbbbbbbbbbb.jpg

Posted

Hello tombu, thanks for responding ‼‼
Do you think you can help me with a simpler code that can only get the average Azimuth ❓❓
That Routine that you told me does not give the average Azimuth in text, what it does is create lines and it is a level of programming that I still do not know how to understand, or make modifications to it myself, or even understand it, ha ha ha
Real apologies friend.
And thanks in advance ‼‼‼

Posted
3 hours ago, tombu said:

Hello, thanks for the new recommendation, it really looks interesting and it seems that it can do what I want.
The only thing left for me is to figure out how to translate that command into Lisp code 🤔🤔🤔

Posted
11 hours ago, tombu said:

hi bro, i am trying and not always the object move inside the pline
how can i get it pls ?
thanks !

 

Posted

Try this

 

; Put number at 1/2 internal angle 
; By AlanH May 2024

(defun c:labmid ( / oldsnap dist p1 p2 p3 p4 ang1 ang2 ang3)

(setq x 1)
;; Get Inside Angle  -  Lee Mac
;; Returns the smaller angle subtended by three points with vertex at p2
(defun LM:GetInsideAngle ( p1 p2 p3 )
    (   (lambda ( a ) (min a (- (+ pi pi) a)))
        (rem (+ pi pi (- (angle p2 p1) (angle p2 p3))) (+ pi pi))
    )
)

; clockwise check by G Carlo
(defun gc:clockwise-p ( p1 p2 p3 ) (< (sin (- (angle p1 p3) (angle p1 p2))) -1e-14))

(setq oldsnap (getvar 'osmode))

(setq dist (getreal "\nEnter radial distance from corner "))

(setvar 'osmode 35)
(while (setq p1 (getpoint "\nPick 1st point away from intersection Enter to exit "))

  (setvar 'osmode 32)
  (setq p2 (getpoint "\nPick point at intersection "))
  
   (setvar 'osmode 35)
  (setq p3 (getpoint "\nPick 3rd point away from intersection "))
  
   (setq ang3 (/ (LM:GetInsideAngle p1 p2 p3 ) 2.0))
   (setq ang1 (angle p1 p2))
   
   (if (gc:clockwise-p p1 p2 p3 )
     (setq p4 (polar p2 (+ ang1 ang3 pi) dist))
     (setq p4 (polar p2 (- ang1 ang3 pi) dist))
   )
   
   (setvar 'osmode 0)
   (command "text" p4 1.0 0.0 (rtos X 2 0))

   (setq x (1+ x))

   (setvar 'osmode 35)
)

(setvar 'osmode oldsnap)

(princ)

)
(c:labmid)

  

 

  • Like 1

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...