mrbradley1 Posted March 29, 2011 Posted March 29, 2011 Can someone help me with a lisp file. I'm wanting to draw a series of 45 degrees lines between 2 points to represent a weld see attached. Also if possible to specify the length of the 45 degree line and spacing of these. I've not got much experience with lisp files so please help if you can Quote
mdbdesign Posted March 29, 2011 Posted March 29, 2011 What about bounding box and hatch inside and delete bounding box? Explode hatch after? Quote
Ahankhah Posted March 29, 2011 Posted March 29, 2011 I think it is better to use hatch object to get the mark. note: there is no error traping in the following code: (defun C:DrawWeld () (setq len (getdist "\nSpecify length: ")) (setq ang 45.0) (setq obj-pt (entsel "\nSelect object: ")) (setq obj (car obj-pt)) (setq dist (getdist "\nSpecify distance between lines: ")) (command "_.COPY" obj "" "_Displacement" "_NONe" (strcat (rtos len) "<" (rtos ang)) ) (setq tempobj (entlast)) (command "_.HATCH" "_User" ang dist "_No" obj tempobj "") (entdel tempobj) ) (C:DrawWeld) Quote
Ahankhah Posted March 29, 2011 Posted March 29, 2011 (edited) mdbdesign, when I was writing the code, your reply was added to the thread. As you see, I think like you about the solution... Edited March 29, 2011 by Ahankhah Quote
mrbradley1 Posted March 29, 2011 Author Posted March 29, 2011 thanks for the reply guys, thought about the array and hatch but I use this quite alot and was trying to find an easy way round it.....Ahankhah the bit of code you've wrote, does this work? Quote
Ahankhah Posted March 29, 2011 Posted March 29, 2011 mrbradley1, it works correctly. Just now I tested it in AutoCAD 2012 Quote
mdbdesign Posted March 29, 2011 Posted March 29, 2011 Just now I tested it in AutoCAD 2012 How do you like work on A2012? Quote
SOliver Posted March 29, 2011 Posted March 29, 2011 You could always try look into the hatch offset and calculate the scale accordingly, however; I feel compelled to refer you back to my orginal comment, perhaps creating a block with the created lines for neatness. Hopefully not too cheeky a comment:lol: Quote
eldon Posted March 29, 2011 Posted March 29, 2011 I know that you have had a lisp written for you, but perhaps the command Measure or Divide with a block, would have given you the desired outcome Quote
mrbradley1 Posted March 29, 2011 Author Posted March 29, 2011 Sorry about that Ahankhah it does work . I'm using 2005 at work and 2011 at home. for some reason it works on 2011 but not on 2005 any idea why???? Quote
alanjt Posted March 29, 2011 Posted March 29, 2011 Sorry about that Ahankhah it does work . I'm using 2005 at work and 2011 at home. for some reason it works on 2011 but not on 2005 any idea why????"Displacement" wasn't supported in a version that old. Change it to '(0. 0. 0.). Quote
mrbradley1 Posted March 29, 2011 Author Posted March 29, 2011 Thanks, i'll have to try this tomorrow at work Quote
Ahankhah Posted March 29, 2011 Posted March 29, 2011 How do you like work on A2012? I love all versions of AutoCAD:huh: except Version 13 for DOS:sweat:. Quote
Lee Mac Posted March 29, 2011 Posted March 29, 2011 (edited) How about a Linear Array... LinearArray.lsp Edited March 29, 2011 by Lee Mac Quote
SOliver Posted March 29, 2011 Posted March 29, 2011 How about a Linear Array... [ATTACH]26749[/ATTACH] Hat's off to you Lee; great use of the grread function Quote
alanjt Posted March 29, 2011 Posted March 29, 2011 This whole thread may be of interest... http://www.theswamp.org/index.php?topic=37459.0 Quote
Ahankhah Posted March 30, 2011 Posted March 30, 2011 Sorry about that Ahankhah it does work . I'm using 2005 at work and 2011 at home. for some reason it works on 2011 but not on 2005 any idea why???? "Displacement" wasn't supported in a version that old. Change it to '(0. 0. 0.). As I can remember,it was supported in earlier versions as de facto. Just replace "Displacement" with "" in the code. Quote
Recommended Posts
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.