Jump to content

Line Macro


JoeyG_77

Recommended Posts

Hey everyone ... Im trying to make a macro that will when I pick 2 points that it will draw that line .074 short of the 2 points in the Y axis.  Im having trouble with the code for it. This is all I have so far and it wont go any further after I get to the from.  

^C^C_LINE;\FROM;\@.074<-90;;

Thanks 
Joey G

Link to comment
Share on other sites

You would be better writing in lisp. Its easy to get the two points x & Y then subtract the 0.074 from the Y then draw a line.

 

; draw a line with  y amount changed
; By Big-al Feb 2019

(defun c:074 ( / pt1 pt2 x1 x2 y1 y2 diff)

;(setq diff (getreal "Enter difference)) ; use this if want to enter value

(setq diff 0.074) ; remove this line if use line above
(setq pt1 (getpoint "Pick 1st point"))
(setq x1 (car pt1)) 
(setq y1 (+ (cadr pt1) diff)) ; add 0.074 to Y
(setq pt2 (getpoint "Pick point 2"))
(setq x2 (car pt2))
(setq y2 (- (cadr pt2) diff)) ; subtract 0.074 from Y
(setq pt2 (list x2 y2)) ; make new co-ords
(command "line" pt1 pt2 "") ; draw a line 
)


 

Edited by BIGAL
Link to comment
Share on other sites

No worries very easy request.

 

How often do you do this offset in a dwg and do you change the offset value ? There is a shortcut method if offset varies.

Link to comment
Share on other sites

Hey BIGAL ... Thanks again for all the help w/ many lisps and advice given over the years.  You asked a question and I didnt know how to answer about the offset value. I have something along the same line but alittle more involved i think.

I work for a cabinet shop and making changes all the time.  I would need a lisp that would be able to pick 2 points then ask what my subtraction would be and then minus that from the overall dimension that you picked in the beginning.  Then you would have to divide that into equal spaces based on a number you entered.  Then it would draw 6" lines @ every point .

X1.JPG

Link to comment
Share on other sites

So you draw a rectang and dimension it but the dim has to have a undersize tolerance so you can push it in, correct ? That is easy use dimension overide and change dim value. I am not sure about the offset lines post a couple of examples. When doing a BIM of the sheets check for textoverride value and use that.

 

; IAcadDimRotated: AutoCAD Rotated Dimension Interface
; Property values:

;   Measurement (RO) = 44.09

;   TextOverride = ""

 


; change dimension value by an amount
; By Alan H March 2019

(defun c:foo ( / ans dist obj)
(setq obj (vlax-ename->vla-object (car (entsel "\nPick Dimension"))))
(setq dist (getreal "enter distance"))
(setq ans (vla-get-measurement obj))
(setq ans (- ans dist))
(vla-put-TextOverride obj (rtos ans 2 2))
)
(c:foo)

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...