Jump to content

How make dimensions to a line?


danyra

Recommended Posts

I have this points with his line:

 

(setq p1 (getpoint "\nPunto Inicial:"))
(setq p2 (polar p1 0 0.5))

 

(entmakex (list '(0 . "line") (cons 10 p1) (cons 11 p2) '(62 . 2)))

 

 

How can I make dimensions of this? 

with the same caracteristics of the image below

 

Thanks for help.

Sin título2.png

Edited by danyra
Link to comment
Share on other sites

Perhaps the easiest way to create the dimension would be something like:

(defun c:test ( / ln p1 p2 )
    (if (setq p1 (getpoint "\nPunto inicial: "))
        (progn
            (setq p2 (mapcar '+ p1 '(0.5 0 0))
                  ln (entmakex (list '(0 . "LINE") (cons 10 (trans p1 1 0)) (cons 11 (trans p2 1 0)) '(62 . 2)))
            )
            (command "_.dimlinear" "" (list ln p1) "_non" (mapcar '+ p1 '(0 -0.5 0)))
        )
    )
    (princ)
)

This approach also has the advantage of creating an associative dimension.

 

The appearance and measurement formatting should be controlled by your Dimension Style.

Edited by Lee Mac
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

6 hours ago, Lee Mac said:

(if (setq p1 (getpoint "\nPunto inicial: ")) (progn (setq p2 (mapcar '+ p1 '(0.5 0 0)) ln (entmakex (list '(0 . "LINE") (cons 10 (trans p1 1 0)) (cons 11 (trans p2 1 0)) '(62 . 2))) ) (command "_.dimlinear" "" (list ln p1) "_non" (mapcar '+ p1 '(0 -0.5 0))) ) ) (princ)

 


But if the line is a variable, it will not always measure 0.5. How would it be in that case? Because this variable will be written by the user with this:

 

(setq l1 (getreal "\nLongitud de Apoyo:"))
            
Its not a number exactly. Its a variable....      

 

 

I dont want that make a line also. Just the dimension, because I already have the line drawed.

 

thanks for your help again @Lee Mac

Edited by danyra
Link to comment
Share on other sites

Here is another example.

 

; 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)

uses a dcl for input

 

image.png.fea87065d96397272a8af2c081f600b9.png

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...