- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello friends, I developed a command (Down here) a long time ago with the help of friends here, but there are a few missing parts for it to work as we want. I would like the Text command to be 200 units. I also want the line drawn in the middle to work with the PL command because I want to be able to change the thickness of all lines. I want the global width of the rectangle and the middle line to be 50 mm. Finally, I want the text to be in the middle of the line, framed as in the example, and brought to the front using the draworder command. Thank you so much...🙂
(defun c:wapeningstype ()
(setq startPoint (getpoint "\nSelect the first point of the rectangle: ")) ; Prompt the user to select the first point of the rectangle
(setq endPoint (getcorner startPoint "\nSelect the other corner of the rectangle: ")) ; Prompt the user to select the other corner of the rectangle
(command "_.RECTANGLE" startPoint endPoint) ; Create a rectangle using the selected points
(vla-put-color (vlax-ename->vla-object (entlast)) 1)
(setq lowerLeftCorner startPoint) ; Get the corners of the rectangle
(setq upperRightCorner endPoint) ; Get the corners of the rectangle
(command "_.LINE" lowerLeftCorner upperRightCorner "") ; Create a line from the lower-left corner to the upper-right corner
(vla-put-color (vlax-ename->vla-object (entlast)) 1)
; Calculate the midpoint of the line
(setq lineMidPoint (polar lowerLeftCorner (angle lowerLeftCorner upperRightCorner) (/ (distance lowerLeftCorner upperRightCorner) 2.0)))
(setq userInput (getstring "\nEnter the information: ")) ; Prompt the user to enter information
; Add an MTEXT (multiline text) containing the user-entered information to the middle of the line
; (command "_.MTEXT" lineMidPoint "@1.0,1.0" userInput "") ; opposite corner changed to relative to the first corner.
(vla-put-color
(vla-addmtext (vla-get-block (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object))))
(vlax-3d-point lineMidPoint)
0
userInput
)
1
)
(vla-put-height (vlax-ename->vla-object (entlast)) 160)
; End the function
(princ)
)
Solved! Go to Solution.