AUTOMATIC BASEPLATE DIMENSION

AUTOMATIC BASEPLATE DIMENSION

Anonymous
Not applicable
2,433 Views
8 Replies
Message 1 of 9

AUTOMATIC BASEPLATE DIMENSION

Anonymous
Not applicable

Hi everyone:

 

I want to create automatic dimensions for a baseplate.

 

1.- I have the lisp for creating the baseplate and its holes, I think it's ok.

(defun C:PLACABASE ( / pt1 pt2 pt3 pt4 Ancho Alto Radio Anchoejex Anchoejey agujero11 agujero12 agujero21 agujero32)
(command "-layer" "set" "Acero Estructural" "")
(setq Ancho (getint "\nInserte Ancho de placa: "))
(setq Alto (getint "\nInserte Alto de placa: "))

(setq pt1 '(0 0 0))
(setq pt2 (list Ancho 0 0))
(setq pt3 (list Ancho Alto 0))
(setq pt4 (list 0 Alto 0))
(command "line" pt1 pt2 pt3 pt4 "c")

(setq Radio (getint "\nInserte Radio de Agujero: "))
(setq Anchoejex (getint "\nInserte distancia de separacion para el eje x: "))
(setq Anchoejey (getint "\nInserte distancina de separacion para el eje y: "))
(setq agujero11 (+ Anchoejex 0))
(setq agujero12 (- Alto Anchoejey))
(setq agujero21 (- Ancho Anchoejex))
(setq agujero32 (+ Anchoejey 0))

(command "circle" (list agujero11 agujero12) Radio
"circle" (list agujero21 agujero12) Radio
"circle" (list agujero11 agujero32) Radio
"circle" (list agujero21 agujero32) Radio
))

2.- I need to create an automatic dimension like this image.

zagalamejiajose_0-1590897777481.png

3.- I have my own dimension style, text style, and separation between line and dimensions, I have some predefined scales with the styles, these scales are the most usual for my work like this image.

zagalamejiajose_1-1590898171505.png

4.- Another problem I have is the scale, I need to add structural details like the baseplate, but generally the drawings are in 1:75 scale, and the details need 1:10 scale, is necessary to create a new dimension style that starts with the original dimension scale for example this image the scale of the drawing plant view is 1:75 and the details are in 1:10 with the same dimension style but different scale factor:

zagalamejiajose_2-1590898837071.png

5.- I was trying with the first lisp something like this without success. I try to get the generated points, and make a reference for the new dimensions.

(command "dimlinear" (list 0 Alto) (list Ancho Alto) (+ Alto +30))    

 

(30 is the separation between the line and dimension according the scale that is working)

 

Thanks for the given attention, I hope you can understand the idea, my English is too bad.

 

Best Regards my friends

0 Likes
Accepted solutions (1)
2,434 Views
8 Replies
Replies (8)
Message 2 of 9

Sea-Haven
Mentor
Mentor

Have a look at this.

 

; simple draw a box and dimension it 
; By Alan H March 2019
' info@alanh.com.au

(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)
Message 3 of 9

devitg
Advisor
Advisor

@Anonymous , Please upload you sample DWG

0 Likes
Message 4 of 9

Anonymous
Not applicable

Hi, I have attached a file with the baseplate example.

 

 

 

 

Thanks for the Help

 

 

0 Likes
Message 5 of 9

Anonymous
Not applicable

Alan, good night:

 

I'm trying the given informatión, but I can't do it.

 

Could you send me some screenshots of this? as you know I'm a complete beginner in this new amazing world.

By the way, do you know about some material, books, youtube channel, etc for AutoLISP beginners, level 0 for me?

 

And thank you again Alan.

 

Best regards

0 Likes
Message 6 of 9

Sea-Haven
Mentor
Mentor
Accepted solution

Easy one 1st got to Kindle look up Renaldo has 4 books very cheap and well written.

 

Multiple lisp tutorials here https://www.afralisp.net/index.php

 

You need to copy the two code samples to a location that can be found by Autocad in what is known as supported file paths. A simple way is from explorer drag multi getvals.lsp onto Autocad say yes to trusted if it displays, then drag box.lsp again trusted follow the prompts enter say 200 100 when asked and pick a point for the rectang. 

 

Read box.lsp line by line that is the steps, it uses polar a lot to work out the points for drafting.

 

Re a base plate with 4 corner holes you should google "Dynamic block base plate" a possible better way no code required. I am sure someone has one. Just start with what you have.

 

screenshot209.png

Message 7 of 9

devitg
Advisor
Advisor

@Anonymous  Hola José. Buen día. va mi primer libro de LISP , como si fueras a 1 grado de la elemental, UPA se llamaba aquí. 

 Lo uso , actualmente , desde 1995 aproximadamente 

 

 

 

 

0 Likes
Message 8 of 9

Anonymous
Not applicable

Alan, Good afternon:

Sorry for don´t answer you on time, the work you know.

Now I understand it, is the thing I´m looking for, but the programattion is the problem for me, so I´m watching afralisp webpage and I have the Reinaldo Togores book, the bad notice is I don´t understand anything.

 

I will begin with afralisp for beginners.

 

Thank you for the help my friend  

0 Likes
Message 9 of 9

Sea-Haven
Mentor
Mentor

When you have a question post here. 

 

Draw a picture on paper to help remember pt numbers then can use for dimensioning.

 

screenshot214.png

0 Likes