Message 1 of 9
Creating custom shape with formed leg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am working on a LISP routine to create a formed angle. I have been slowly adding to my routine to go from a simple box to a 90 degree angle shape. I am hoping to have one of the legs be able to be set to a different angle than 90 degrees based on user input, similar to how the leg lengths are set. I know this code has a long way to go, but any and all help and input would be greatly appreciated.
The following is what I have so far:
(defun C:BAA ( / pt LG1 LG2 THK1 pty ptx ipty iptx ipt dtr ang1) ; -Localizes the variables.
(setq CL (getvar "clayer")) ; -Gets the current layer.
(command "layer" "m" "0" "c" 4 "" "l" "continuous" "" nil) ; -Creates and sets layer 0.
(setq lm (getvar "limcheck")) ; -Gets the current limit setting.
(setvar "limcheck" 0) ; -Sets limits to 0 or off.
(defun dtr (d) ; -Defines the degrees to radians. Remember to change it back.
(* pi (/ d 180.0)) ; -Angle divided by 180, then total is multiplied by Pi.
); -Closes Rad function.
(defun rtd (r) ; -Defines the radians to degrees.
(* 180.0 (/ r pi))
); -Closes Deg function.
(if
(and
(setq pt (getpoint "Please choose a start?")) ; -Bottom left starting point of leg.
(setq LG1 (getreal "Please enter the 1st leg length?")) ; -Vertical leg length.
(setq LG2 (getreal "Please enter the 2nd leg length?")) ; -Horizontal leg length.
(setq THK1 (getreal "How thick is the member?")) ; -Thickness of the angle member.
(setq ang1 (getreal "Set the angle please...")) ; -Sets the angle.
); Closes and
(progn ; -code block that processes the inputs
(setq pty (polar '+ pt ( (dtr 0) 0.0 LG1 0.0))) ; -Outside of vertical leg.
(setq ptx (polar '+ pt ( (dtr ang1) LG2 0.0 0.0))) ; -Outside of horizontal leg.
(setq ipty (polar '+ pty ( (dtr 0) THK1 0.0 0.0))) ; -Inside of vertical leg.
(setq iptx (polar '+ ptx ( (dtr ang1) 0.0 THK1 0.0))) ; -Inside horizontal leg.
(setq ipt (polar '+ pt ( THK1 THK1 0.0))) ; -Inside intersection.
(command "pline" pt ptx iptx ipt ipty pty "c") ; -Polyline to make the angle.
); -Closes progn
); -Closed if
(command "rtd") ; -To convert back to degrees.
(command "layer" "s" cl "") ; -To set layer back to original.
(setvar "limcheck" lm) ; -To reset limit to starting limit.
); -Closes defun