Author Topic: Still learning, but now trying to make an "L" shape.  (Read 3052 times)

0 Members and 1 Guest are viewing this topic.

BIGAL

  • Swamp Rat
  • Posts: 1396
  • 40 + years of using Autocad
Re: Still learning, but now trying to make an "L" shape.
« Reply #15 on: July 07, 2022, 09:42:02 PM »
The (if (not loads the multi getvals if not loaded, you can do 2 solutions.

Save the file in a support file location. Make a directory if you dont have one for saving all the code you get from here.

Or use Appload add to Startup Suite Multi Getvals.lsp this is the way I have it set up.

The program is designed to not copy the code into every other program rather just call it geberally around 3 lines, you can also save previous selections as defaults when ran again. But only in current session. There is also Multi Radio Buttons, Multi Radio Buttons 2col and  Multi Toggles.

Lastly all my code uses this method now for initget style input nad value input. Been at it for like 40 years coding.

ALMOST FORGOT did you look at your post on other forums, new code includes angles.

Code: [Select]
; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/creating-custom-shape-with-formed-leg/td-p/11281202

; angle design

; Sample chart:
; Original code by Grrr
; Modified by Alanh to do 4 directions July 2022

;      pt2  pt3
;       |  |
;       |  |
;       |  |
;       |  | pt4
;       |  |___________ pt5
; pt1 |________________ pt6
;
;
(defun C:BAA ( / oldsnap pt1 LG1 LG2 THK1 l1 l2 l3 l4 pt1 pt2 pt3 pt4 pt5 pt6) ; always localise your variables

(defun dtr (a)
(* pi (/ a 180.0))
)

(setq pi90 (/ Pi 2.0) pi270 (* 1.5 pi))

(if (not AH:getvalsm)(load "Multi Getvals.lsp"))

(if (= (setq  pt1 (getpoint "Choose a starting point")) nil)
(alert "User interrupted an input")
(progn
  (setq ans (AH:getvalsm (list "Enter values " "Height  " 6 5 "100" "ANG1" 6 5 "0" "Length " 6 5 "150" "ANG2" 6 5 "90" "Thick " 6 5 "10" )))
  (setq LG1 (atof (nth 0 ans)) ang1 (dtr (atof (nth 1 ans))) lG2 (atof (nth 2 ans)) ang2 (dtr (atof (nth 3 ans))) THK1 (atof (nth 4 ans)))
  (setq oldsnap (getvar 'osmode) oldaunits (getvar 'aunits))
  (setvar 'osmode 0)
  (setvar 'aunits 3)

(setq pt2 (polar pt1 (+ pi90 ang1) lg1))
(setq pt3 (polar pt2 ang1 THK1))
(setq pt4 (polar pt3 (+ pi270 ang1) lg1))
(setq pt6 (polar pt1 (+ pi270 ang2) lg2))
(setq pt5 (polar pt6 ang2 thk1))
(setq pt7 (polar pt5  (- ang2 pi270) lg2))
(command "_.pline" pt4 pt3 pt2 pt1 pt6 pt5  pt7 "")
(setq pt6 (mapcar '* (mapcar '+ pt7 pt5) '(0.5 0.5)))
(setq pt7(mapcar '* (mapcar '+ pt3 pt4) '(0.5 0.5)))
(setvar 'filletrad 0.0)
(command "fillet"  pt6 pt7)

 (setvar 'osmode oldsnap)
 (setvar 'aunits oldaunits)
 
   ); progn
 ); if
  (princ)
); defun C:BAA
(c:baa)
« Last Edit: July 07, 2022, 09:47:01 PM by BIGAL »
A man who never made a mistake never made anything

Curious Drafter

  • Mosquito
  • Posts: 18
  • Marine r try use big brain not stronk arms...
Re: Still learning, but now trying to make an "L" shape.
« Reply #16 on: July 08, 2022, 09:28:20 AM »
I am very grateful for your code Al, and I can easily use it to do what I want it to do, but I am hoping to learn how to code what I want to do without outside lisp commands and why things work the way they do. I know that just about everything I would ever want to do and more is already done, but I really want to learn the ins and outs so I can do what you did on my own. I know I am a some what slow learner, but I am trying and want to make my skills better. I think if I go go line by line I can transfer hat I want to do to my own code, but it will take time. I think the main thing I am looking for now is a "what did I do wrong and what/how will it work in theory".

I definitely have a great place to start, but I hope to understand the language and how it works together. So thank you everyone for your help and patience while I learn.

BIGAL

  • Swamp Rat
  • Posts: 1396
  • 40 + years of using Autocad
Re: Still learning, but now trying to make an "L" shape.
« Reply #17 on: July 08, 2022, 10:01:06 PM »
Good to hear your having a go so many just ask for free, with projects like this I get a pen and paper draw the shape and label all the points. So work out next point then last join together line/pline.

I wrote some code then used copy and paste a line to command line, getpoint 1, work out next pt2 using polar, then I typed Line !pt1 !pt2 Enter and  a line was drawn note "!" so could check line was going in correct direction, just repeated this for all line segments. Re the inside point I could have used a Tan function to work out the angle for the polar but it was easier to let Acad fillet the 1st and last line.
A man who never made a mistake never made anything

Curious Drafter

  • Mosquito
  • Posts: 18
  • Marine r try use big brain not stronk arms...
Re: Still learning, but now trying to make an "L" shape.
« Reply #18 on: July 12, 2022, 10:28:07 AM »
I think I am getting closer to having a working code, but it's no longer drawings the lines. I am also getting a new error, but I'm a little stumped on what's not working correctly.

Code - Auto/Visual Lisp: [Select]
  1. (defun C:BAA ( / pt1 LG1 LG2 THK1 L1 L2 L3 L4 pt2 pt3 pt4 pt5 pt6 pt7 piA piB ans dtr) ; -Localizes the variables.
  2.  
  3.  
  4.         (setq CL (getvar "clayer"))                                     ; -Gets the current layer.
  5.        
  6.         (command "layer" "m" "0" "c" 4 "" "l" "continuous" "" nil)      ; -Creates and sets layer 0.
  7.  
  8.         (setq lm (getvar "limcheck"))                                   ; -Gets the current limit setting.
  9.  
  10.         (setvar "limcheck" 0)                                           ; -Sets limits to 0 or off.
  11.  
  12.        
  13.         (defun dtr (d)                                                  ; -Defines the degrees to radians. Remember to change it back.
  14.  
  15.                 (* pi (/ d 180.0))                                      ; -Angle divided by 180, then total is multiplied by Pi.
  16.  
  17.                 ); -Closes Radian function.
  18.  
  19.         (setq piA (/ Pi 2.0) piB (* 1.5 pi))
  20.  
  21.  
  22.         (if
  23.  
  24.                                
  25.                 (and
  26.  
  27.                 (setq pt1 (getpoint "Please choose a start?"))          ; -Bottom left starting point of leg.
  28.  
  29.                 (setq LG1 (getreal "Please enter the 1st leg length?")) ; -Vertical leg length.
  30.  
  31.                 (setq LG2 (getreal "Please enter the 2nd leg length?")) ; -Horizontal leg length.
  32.  
  33.                 (setq THK1 (getreal "How thick is the member?"))        ; -Thickness of the angle member.
  34.  
  35.                 (setq ang1 (getreal "Set the angle please..."))         ; -Sets the angle.
  36.  
  37.                 ); Closes and
  38.  
  39.         (progn
  40.  
  41.                                        
  42.                 (setq pt2 (polar pt1 (+ piA ang1) LG1))
  43.  
  44.                 (setq pt3 (polar pt2 ang1 THK1))
  45.  
  46.                 (setq pt4 (polar pt3 (+ piB ang1) LG1))
  47.  
  48.                 (setq pt6 (polar pt1 (+ piB ang2) LG2))
  49.  
  50.                 (setq pt5 (polar pt6 ang2 thk1))
  51.  
  52.                 (setq pt7 (polar pt5  (- ang2 piB) LG2))
  53.  
  54.                 (setq pt6 (mapcar '* (mapcar '+ pt7 pt5) '(0.5 0.5)))
  55.  
  56.                 (setq pt7(mapcar '* (mapcar '+ pt3 pt4) '(0.5 0.5)))
  57.  
  58.                 (command "pline" pt4 pt3 pt2 pt1 pt6 pt5  pt7 "c")      ; -Polyline to make the angle.
  59.  
  60.                 (setvar 'filletrad (* THK1 0.5))
  61.  
  62.         (command "fillet"  pt6 pt7)
  63.  
  64.  
  65.          ); -Closes progn
  66.  
  67.          ); -Closes if
  68.  
  69.         (princ)
  70.  
  71.         (command "layer" "s" cl "")                                     ; -To set layer back to original.
  72.  
  73.         (setvar "limcheck" lm)                                          ; -To reset limit to starting limit.
  74.  
  75.  
  76. ); -Closes defun
  77.  

This is the code and the error I get back "; error: bad argument type: numerp: nil"

Any and all feedback as greatly appreciated.

ScottMC

  • Newt
  • Posts: 191
Re: Still learning, but now trying to make an "L" shape.
« Reply #19 on: July 12, 2022, 05:34:27 PM »
No 'ang2'..  turn the fillet off too. Now it's getting the order of coords to work for the pline.

BIGAL

  • Swamp Rat
  • Posts: 1396
  • 40 + years of using Autocad
Re: Still learning, but now trying to make an "L" shape.
« Reply #20 on: July 12, 2022, 09:24:38 PM »
Curious drafter you only need to check say you have picked a point or maybe pressed esc.

Your welcome to use my multi getvals.lsp it is a library program can be used in any program just change the list to suit. Just make sure its saved in a support path or autoload on startup. You can cahnge the default values you can save the default values between goes can explain if required.

Code: [Select]
(if (not AH:getvalsm)(load "Multi Getvals.lsp"))

(if (= (setq  pt1 (getpoint "Choose a starting point")) nil)
(alert "User interrupted an input")
(progn
  (setq ans (AH:getvalsm (list "Enter values " "Height  " 6 5 "100" "Length " 6 5 "150"  "Thick " 6 5 "10" "ANGLE" 6 5 "90")))
  (setq LG1 (atof (nth 0 ans))  LG2 (atof (nth 2 ans))  THK1 (atof (nth 4 ans)) ang1 (* pi (/ (atof (nth 3 ans)) 180.0)) )


« Last Edit: July 12, 2022, 09:29:24 PM by BIGAL »
A man who never made a mistake never made anything

Curious Drafter

  • Mosquito
  • Posts: 18
  • Marine r try use big brain not stronk arms...
Re: Still learning, but now trying to make an "L" shape.
« Reply #21 on: August 02, 2022, 11:51:37 AM »
I decided to try and take it back a couple steps and make sure I get my head wrapped around everything again so I can see how and why things are or are not working for me. I altered my lisp back to the following:
Code - Auto/Visual Lisp: [Select]
  1. (defun C:BAA ( / pt1 LG1 LG2 THK1 pt2 pt3 pt4 pt5 pt6) ; -Localizes the variables.
  2.  
  3.  
  4.         (setq CL (getvar "clayer"))                                     ; -Gets the current layer.
  5.        
  6.         (command "layer" "m" "0" "c" 4 "" "l" "continuous" "" nil)      ; -Creates and sets layer 0.
  7.  
  8.         (setq lm (getvar "limcheck"))                                   ; -Gets the current limit setting.
  9.  
  10.         (setvar "limcheck" 0)                                           ; -Sets limits to 0 or off.
  11.  
  12.  
  13.         (if
  14.  
  15.                                
  16.                 (and
  17.  
  18.                 (setq pt1 (getpoint "Please choose a start?"))          ; -Bottom left starting point of leg.
  19.  
  20.                 (setq LG1 (getdist "Please enter the 1st leg length?")) ; -Vertical leg length.
  21.  
  22.                 (setq LG2 (getdist "Please enter the 2nd leg length?")) ; -Horizontal leg length.
  23.  
  24.                 (setq THK1 (getdist "How thick is the member?"))        ; -Thickness of the angle member.
  25.  
  26.                 (setq ang1 (getangle "Set the angle please..."))        ; -Sets the angle.
  27.  
  28.                 ); Closes and
  29.  
  30.         (progn                                                          ; -Code block that processes the inputs
  31.  
  32.                                        
  33.                 (setq pt2 (polar pt1 1.57 LG1))                         ; changed for testing
  34.  
  35.                 (setq pt3 (polar pt2 0 THK1))                           ; changed for testing
  36.  
  37.                 (setq pt4 (polar pt3 4.71 (- LG1 THK1) ))               ; changed for testing
  38.  
  39.                 (setq pt5 (polar pt4 6.28 (- LG2 THK1) ))               ; changed for testing
  40.  
  41.                 (setq pt6 (polar pt5 4.71 thk1))                        ; changed for testing
  42.  
  43.                 (command "pline" pt1 pt2 pt3 pt4 pt5 pt6 "c")           ; -Polyline to make the angle.
  44.  
  45.                 (setvar 'filletrad (* THK1 0.5))                        ; -Sets the fillet radius.
  46.  
  47.         ; -For later use -command "fillet" at outside point typical-    ; -Creates radius at external corner
  48.  
  49.  
  50.          ); -Closes progn
  51.  
  52.          ); -Closes if
  53.  
  54.         (princ)
  55.  
  56.         (command "layer" "s" cl "")                                     ; -To set layer back to original.
  57.  
  58.         (setvar "limcheck" lm)                                          ; -To reset limit to starting limit.
  59.  
  60.  
  61. ); -Closes defun

Still working out the kinks, but attached is the slightly cleaned up end goal for now. I am hoping to eventually have my lisp so all that is needed is to enter the known and needed values and have it generate a fully dimensioned shape like in the dwg. I finally have it making an "L" again and will change it so that it will use "dtr" instead of using radians as it does now.

I know I can use and I am grateful for the permission to use the multi getvals.lsp, but I am still hoping to create the routine from the ground up. Hopefully it helps me to better understand what I am doing instead of just poking in the dark.

For now I am going to read what I can find and have been sent again now that I have a clearer picture of what does and doesn't work so far. Any tips are still greatly appreciated and thank you for your patience when I am surely causing frustration.

BIGAL

  • Swamp Rat
  • Posts: 1396
  • 40 + years of using Autocad
Re: Still learning, but now trying to make an "L" shape.
« Reply #22 on: August 02, 2022, 11:26:25 PM »
As you say use the getreal etc multiple times then when ready add the multi getvals.

Have a look at this re dims.

Code: [Select]
; simple draw a box and dimension it
; By Alan H March 2019


(defun ah:box ( / pt1 pt2 pt3 ahl ahh ahoff )
(setq oldsnap (getvar 'osmode))
(setq oldang (getvar 'angdir))
(setq pt1 (getpoint "\nPick lower left"))
(setvar 'osmode 0)
(if (not AH:getvalsm)(load "Multi Getvals.lsp"))
(setq ans (AH:getvalsm (list "Simple rectang" "Enter length" 8 7 "1" "Enter height " 8 7 "2")))
(setq ahL (atof (nth 0 ans)))
(setq ahH (atof (nth 1 ans)))
(setq pt2 (polar pt1 0.0 ahl))
(setq pt3 (polar pt2 (/ pi 2.0) ahH))
(command "rectang" pt1 pt3)
(setq ahoff (* 2.0 (* (getvar 'dimasz)(getvar 'dimscale)))) ; change offset as required
(setq pt4 (polar pt2  (* pi 1.5) ahoff))
(command "dim" "hor" pt1 pt2 pt4 "" "exit")
(setq pt4 (polar pt3 0.0 ahoff))
(command "dim" "Ver" pt2 pt3 pt4 "" "exit")
(setvar 'osmode oldsnap)
)
(ah:box)

A man who never made a mistake never made anything

GDF

  • Water Moccasin
  • Posts: 2081
Re: Still learning, but now trying to make an "L" shape.
« Reply #23 on: August 03, 2022, 02:53:25 PM »
Look at AutoCAD’s dline.lsp that comes with AutoCAD.
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

Curious Drafter

  • Mosquito
  • Posts: 18
  • Marine r try use big brain not stronk arms...
Re: Still learning, but now trying to make an "L" shape.
« Reply #24 on: August 09, 2022, 03:10:07 PM »
Well, I took another couple shots at this and I have to say that I still have no clue how the angles work in this code. I only assume I made a greater power angry at some point and now they are laughing.

With this code I can at least make a shape that resembles an angle piece.

Code - Auto/Visual Lisp: [Select]
  1. (defun C:LBA ( / pt1 LG1 LG2 THK1 pt2 pt3 pt4 pt5 p5A pt6 pt7 p7A pt8 pt9) ; -Localizes the variables.
  2.  
  3.  
  4.         (setq CL (getvar "clayer"))                                     ; -Gets the current layer.
  5.        
  6.         (command "layer" "m" "0" "c" 4 "" "l" "continuous" "" nil)      ; -Creates and sets layer 0.
  7.  
  8.         (setq lm (getvar "limcheck"))                                   ; -Gets the current limit setting.
  9.  
  10.         (setvar "limcheck" 0)                                           ; -Sets limits to 0 or off.
  11.  
  12.  
  13.         (if
  14.  
  15.                                
  16.                 (and
  17.  
  18.                 (setq pt1 (getpoint "Please choose a start?"))          ; -Bottom left starting point of leg.
  19.  
  20.                 (setq LG1 (getdist "Please enter the 1st leg length?")) ; -Vertical leg length.
  21.  
  22.                 (setq LG2 (getdist "Please enter the 2nd leg length?")) ; -Horizontal leg length.
  23.  
  24.                 (setq THK1 (getdist "How thick is the member?"))        ; -Thickness of the angle member.
  25.  
  26.                 (setq ang1 (getangle "Set the angle please..."))        ; -Sets the angle.
  27.  
  28.                 ); Closes and
  29.  
  30.         (progn                                                          ; -Code block that processes the inputs
  31.  
  32.                                        
  33.                 (setq pt2 (polar pt1 (/ pi 2) LG1)                      ; -Inside of Vertical Leg
  34.  
  35.                         pt3 (polar pt2 pi LG2)                          ; -Inside of Angled Leg
  36.  
  37.                         pt4 (polar pt3 (/ pi 2) THK1)                   ; -Thickness of Angled Leg
  38.  
  39.                         pt5 (polar pt4 0 (+ LG2 LG1))                   ; -Outside of Angled Leg
  40.  
  41.                         pt6 (polar pt1 0 THK1)                          ; -Outside of Angled Leg
  42.  
  43.                         pt7 (polar pt6 (/ pi 2) (+ LG2 LG1))            ; -Outside of Angled Leg
  44.  
  45.                         pt8 (polar pt1 pi 2)                            ; -Point for Vert Dim
  46.  
  47.                         pt9 (polar pt1 (* pi 1.5) 2)                    ; -Point for Horz Dim -Side note. I am hoping to make this align with the angled leg.
  48.  
  49.                 ;(setq p5A (mapcar '* (mapcar '+ pt4 pt5) '(0.5 0.5))) ; -Not working, set to the side for now.
  50.  
  51.                 ;(setq p7A (mapcar '* (mapcar '+ pt6 pt7) '(0.5 0.5))) ; -Not working, set to the side for now.
  52.  
  53.                 ); Closes setq
  54.  
  55.                 (command "pline" pt7 pt6 pt1 pt2 pt3 pt4 pt5 "")        ; -Polyline to make the angle.
  56.  
  57.                 (setvar 'filletrad (THK1))                              ; -Sets the fillet radius.
  58.  
  59.         ;(command "fillet" p5A p7A)                                     ; -Creates radius at external corner
  60.  
  61.  
  62.          ); -Closes progn
  63.  
  64.          ); -Closes if
  65.  
  66.         (princ)
  67.  
  68.         (command "dim" "hor" pt2 pt3 pt9 "" "exit")                     ; -Creates the Angled Leg Dim.
  69.  
  70.         (command "dim" "ver" pt1 pt2 pt8 "" "exit")                     ; -Creates the Vertical Leg Dim.
  71.  
  72.         (command "layer" "s" cl "")                                     ; -To set layer back to original.
  73.  
  74.         (setvar "limcheck" lm)                                          ; -To reset limit to starting limit.
  75.  
  76.  
  77. ); -Closes defun

When I try to do anything to change the angle is where things to weird and stop being consistent. I have tested a number of different combinations of just angles, radians, angles and radians, rolling dice, etc. but there doesn't seem to be a consistent change when the angle is changed.

The following is an example.

Code - Auto/Visual Lisp: [Select]
  1. (defun C:LBA ( / pt1 LG1 LG2 THK1 pt2 pt3 pt4 pt5 p5A pt6 pt7 p7A pt8 pt9) ; -Localizes the variables.
  2.  
  3.  
  4.         (setq CL (getvar "clayer"))                                     ; -Gets the current layer.
  5.        
  6.         (command "layer" "m" "0" "c" 4 "" "l" "continuous" "" nil)      ; -Creates and sets layer 0.
  7.  
  8.         (setq lm (getvar "limcheck"))                                   ; -Gets the current limit setting.
  9.  
  10.         (setvar "limcheck" 0)                                           ; -Sets limits to 0 or off.
  11.  
  12.  
  13.         (if
  14.  
  15.                                
  16.                 (and
  17.  
  18.                 (setq pt1 (getpoint "Please choose a start?"))          ; -Bottom left starting point of leg.
  19.  
  20.                 (setq LG1 (getdist "Please enter the 1st leg length?")) ; -Vertical leg length.
  21.  
  22.                 (setq LG2 (getdist "Please enter the 2nd leg length?")) ; -Horizontal leg length.
  23.  
  24.                 (setq THK1 (getdist "How thick is the member?"))        ; -Thickness of the angle member.
  25.  
  26.                 (setq ang1 (getangle "Set the angle please..."))        ; -Sets the angle.
  27.  
  28.                 ); Closes and
  29.  
  30.         (progn                                                          ; -Code block that processes the inputs
  31.  
  32.                                        
  33.                 (setq pt2 (polar pt1 (/ pi 2) LG1)                      ; -Inside of Vertical Leg
  34.  
  35.                         pt3 (polar pt2 (* pi (/ (- 270 ang1) 180)) LG2) ; -Inside of Angled Leg
  36.  
  37.                         pt4 (polar pt3 (* pi (/ (- 180 ang1) 180)) THK1)        ; -Thickness of Angled Leg
  38.  
  39.                         pt5 (polar pt4 (* pi (/ (- 90 ang1) 180)) (* LG2 2))    ; -Outside of Angled Leg
  40.  
  41.                         pt6 (polar pt1 0 THK1)                          ; -Outside of Angled Leg
  42.  
  43.                         pt7 (polar pt6 (/ pi 2) (* LG1 2))              ; -Outside of Angled Leg
  44.  
  45.                         pt8 (polar pt1 pi 2)                            ; -Point for Vert Dim
  46.  
  47.                         pt9 (polar pt1 (* pi 1.5) 2)                    ; -Point for Horz Dim  -Side note. I am hoping to make this align with the angled leg.
  48.  
  49.                 ;(setq p5A (mapcar '* (mapcar '+ pt4 pt5) '(0.5 0.5))) ; -Not working, set to the side for now
  50.  
  51.                 ;(setq p7A (mapcar '* (mapcar '+ pt6 pt7) '(0.5 0.5))) ; -Not working, set to the side for now
  52.  
  53.                 ); Closes setq
  54.  
  55.                 (command "pline" pt7 pt6 pt1 pt2 pt3 pt4 pt5 "")        ; -Polyline to make the angle.
  56.  
  57.                 (setvar 'filletrad (THK1))                              ; -Sets the fillet radius.
  58.  
  59.         ;(command "fillet" p5A p7A)                                     ; -Creates radius at external corner
  60.  
  61.  
  62.          ); -Closes progn
  63.  
  64.          ); -Closes if
  65.  
  66.         (princ)
  67.  
  68.         ;(command "dim" "hor" pt2 pt3 pt9 "" "exit")                    ; -Creates the Angled Leg Dim.
  69.  
  70.         (command "dim" "ver" pt1 pt2 pt8 "" "exit")                     ; -Creates the Vertical Leg Dim.
  71.  
  72.         (command "layer" "s" cl "")                                     ; -To set layer back to original.
  73.  
  74.         (setvar "limcheck" lm)                                          ; -To reset limit to starting limit.
  75.  
  76.  
  77. ); -Closes defun

If anyone would point me in a good direction for what I did wrong or how to appease the angry spirits I would greatly appreciate it.

Also, on a side note I decided to change how I create this lisp. I am trying to work it so the 1st leg is always vertical and the 2nd leg rotates around it. I was going to break that into left "LBA" and right "RBA" so the user could pick the side, put in the angle from the vertical and the other dimension. I figured if I did it this way the dimensions provided would always be the inside of the bend. (That's just how the company I work for does things.)

BIGAL

  • Swamp Rat
  • Posts: 1396
  • 40 + years of using Autocad
Re: Still learning, but now trying to make an "L" shape.
« Reply #25 on: August 09, 2022, 08:12:36 PM »
I wrote the double angle answer for you why have you not looked at that ? It may be on the other forum. It did left rights up down etc.
A man who never made a mistake never made anything

Curious Drafter

  • Mosquito
  • Posts: 18
  • Marine r try use big brain not stronk arms...
Re: Still learning, but now trying to make an "L" shape.
« Reply #26 on: August 10, 2022, 08:07:31 AM »
I was having a hard time wrapping my head around how to use that to get the "in between" angles, but I am starting to understand. I think that is one of the main draw backs of trying to self teach something like this.

A lot of pieces of code are hard to find good information on. A good majority can be found here, but as an example with (command "dim" "ver" pt1 pt2 pt8 "" "exit") I understand how that works, except for the "ver" and what options are out there for that placeholder. And with (setq p7A (mapcar '* (mapcar '+ pt6 pt7) '(0.5 0.5))) I thought I had followed the right steps, but AutoCAD is telling me something isn't right with it.

Thanks for the patience and gentle guidance

Curious Drafter

  • Mosquito
  • Posts: 18
  • Marine r try use big brain not stronk arms...
Re: Still learning, but now trying to make an "L" shape.
« Reply #27 on: August 10, 2022, 02:28:32 PM »
Found that I had put the fillet command in the wrong place in the code and the mapcar lines needed to be after the pline command. Also, I was able to get the dimension command to work for both legs, but I am trying to get an angular dimension between the two as well. I tried to re work the line as such (command "dim" "Angular" "Vertex" p2 p3 p1A "" "exit") but it's not working. The line (command "dim" "align" pt2 pt3 pt9 "" "exit") worked great for the angled leg though.

Any guidance would be greatly appreciated.

BIGAL

  • Swamp Rat
  • Posts: 1396
  • 40 + years of using Autocad
Re: Still learning, but now trying to make an "L" shape.
« Reply #28 on: August 10, 2022, 10:19:50 PM »
Its called a pencil, yeah often the answer is just do it manually and write down the steps so your (command just does the same same as when making the shape I drew on a piece of paper the point ids so I knew how to connect for the pline.

The mapcar function can be used to + - * / say 2 points

Code: [Select]
(setq pt3  (mapcar '+ pt1 pt2) )  ;  adds

(setq pt3 (mapcar '(lambda (x) (/ x 2.0)) pt3)   ;  divide pt3 by 2

these 2 are same answer
(setq mp (mapcar '* (mapcar '+ p1 p3) '(0.5 0.5))) ; midpoint of 2 points a double add 2 pts then multiply by 0.5
(setq mp (mapcar '/ (mapcar '+ p1 p3) '(2.0 2.0))) ; midpoint of 2 points a double add 2 pts then divide by 2

(setq pt3 (mapcar '+ pt3 (list X Y 0))) ; adds x and y to a point value can be X or Y or Z

This seems to work for dim ang and pline, it uses mid pt of legs

Code: [Select]
(command "dim" "ang" (ssget pt1)(ssget pt2) pt3 "" "" "exit")
« Last Edit: August 10, 2022, 10:32:29 PM by BIGAL »
A man who never made a mistake never made anything