aloy Posted October 18, 2016 Posted October 18, 2016 Hi everyone, I have a series of lines connected from end to end. I want to do two things: 1) Place a text giving the length of the line on perpendicular bisector near the center of each line. 2) Insert a block (an arrow) at the center of each line aligned with the line. I can do the second, but the first does't work with the following, what ever the angle I give in place of 0, the block appears in the same original rotation. ;(setq plst1(list pt pt1 alfa dis)) ;(setq plist(cons plst1 plist)) (defun draw1() (mapcar '(lambda(a) (command "_insert" "arrow" (car a) 1 1 0)) plist) (mapcar '(lambda(a) (command "_text" "_non"(car a) 0.6 (* (caddr a) 57.3) (rtos (cadddr a) 2 2))) plist) (princ) ) Is there a way to solve this?. Thanking in advance. Aloy Quote
Tharwat Posted October 18, 2016 Posted October 18, 2016 Hi, To align a block, we should know the rotation of the block. If you can upload a sample drawing showing the result , that would be very helpful. Quote
David Bethel Posted October 18, 2016 Posted October 18, 2016 I would recommend looking into ( entmake ) the arrow INSERT [color=#8b4513];|[/color] Assuming : The BLOCK [color=#2f4f4f]"ARROW"[/color] exists in the current drawing The arrow direction points 0 degrees X axis WCS sp = Start Point ep = End Point |[color=#8b4513];[/color] [b][color=BLACK]([/color][/b]entmake [b][color=FUCHSIA]([/color][/b]list [b][color=NAVY]([/color][/b]cons 0 [color=#2f4f4f]"INSERT"[/color][b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]cons 2 [color=#2f4f4f]"ARROW"[/color][b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]cons 10 [b][color=MAROON]([/color][/b]mapcar '[b][color=GREEN]([/color][/b]lambda [b][color=BLUE]([/color][/b]a b[b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]* [b][color=RED]([/color][/b]+ a b[b][color=RED])[/color][/b] 0.5[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] sp ep[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]cons 50 [b][color=MAROON]([/color][/b]angle sp ep[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b] -David Quote
aloy Posted October 18, 2016 Author Posted October 18, 2016 Thanks David & Tharwat for replying. Modified the code a bit as follows: (mapcar '(lambda(a) (entmake (list (cons 0 "INSERT") (cons 2 "ARROW") (cons 10 (car a)) (cons 50 (caddr a))))) plist) Works perfectly. Here is a picture. Quote
Recommended Posts
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.