Chevy Posted September 29, 2010 Share Posted September 29, 2010 Hello, I have been out of the cad life for a little while and i use to do lisp all the time. Now i cant even seem to do 1 routine. I have a Block (steel stair tread and riser) that i want to insert using lisp. I am trying to insert it and based on user input, change the riser height and then array it between a selected floor to floor height. Can anyone or will anyone take a little time to help? Thanks Quote Link to comment Share on other sites More sharing options...
JohnM Posted September 29, 2010 Share Posted September 29, 2010 There are several post dealing with blocks search this site and you will find some to help you Quote Link to comment Share on other sites More sharing options...
lpseifert Posted September 29, 2010 Share Posted September 29, 2010 Look in 'Similar Threads' below Quote Link to comment Share on other sites More sharing options...
Chevy Posted September 29, 2010 Author Share Posted September 29, 2010 Still having trouble but ill keep at it. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted September 29, 2010 Share Posted September 29, 2010 Still having trouble but ill keep at it. Post the code you have so far, Chevy. Quote Link to comment Share on other sites More sharing options...
Chevy Posted September 29, 2010 Author Share Posted September 29, 2010 This is a piece together code from similar threads below and somethings i still remember I would like to make it where it copies from two points on the block (insertion, copy to point) but the biggest thing if any i would like help with is setting up user input to change the riser height (by changing the block reference i guess) and then insert and copy. (defun c:str (/ bNme i ss ent) (command "divide" (entsel"\ Select slope=")(getint "\How many treads??=")) (command "point" (getpoint "\ Pick starting point=")) (setq bNme (getstring 1 "\nRiser Height=")) ;; << Block Name (and (setq i -1 ss (ssget "_X" '((0 . "POINT")))) (while (setq ent (ssname ss (setq i (1+ i)))) (entmake (list (cons 0 "INSERT") (cons 100 "AcDbEntity") (cons 100 "AcDbBlockReference") (cons 2 bNme) (assoc 10 (entget ent)))))) (princ)) Quote Link to comment Share on other sites More sharing options...
BlackBox Posted September 29, 2010 Share Posted September 29, 2010 :: What I understand :: You want to insert a block at a point, and perhaps modify said block based on user input. Then you want a dynamic block, as modifying a non-dynamic block reference changes *all* instances of said block. Unless by modify you mean change attribute values? :: What I do not understand :: What entity type is selected using entsel, a line perhaps? How many points are in the drawing, as (ssget "_x" '((0 . "POINT"))) selects *all* points, when you've only created one. So the riser height is the name of the block? Why insert a point entity at (getpoint) if you're going to (assoc 10 (entget ent))? Are you leaving the point created in the drawing? Instead, why not simply store the point to a variable (setq pt (getpoint)), and (cons 10 pt)? Quote Link to comment Share on other sites More sharing options...
alanjt Posted September 29, 2010 Share Posted September 29, 2010 It seems like you are trying to divide a specified block along a selected line. Divide already has this functionality. eg. Command: DIV DIVIDE Select object to divide: Enter the number of segments or [block]: B Enter name of block to insert: P6 Align block with object? [Yes/No] <Y>: Enter the number of segments: 5 Quote Link to comment Share on other sites More sharing options...
JohnM Posted September 29, 2010 Share Posted September 29, 2010 Just curious Do you have to use blocks? Can you have it just draw what you need, seems it would be easer to make it parametric Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted September 30, 2010 Share Posted September 30, 2010 Hello, I have been out of the cad life for a little while and i use to do lisp all the time. Now i cant even seem to do 1 routine. I have a Block (steel stair tread and riser) that i want to insert using lisp. I am trying to insert it and based on user input, change the riser height and then array it between a selected floor to floor height. Can anyone or will anyone take a little time to help? Thanks I am not sure if this will be helpful, But this program by Dan E. Thomas is very cool. Command Syntax: STAIRS Stairs.Lsp Quote Link to comment Share on other sites More sharing options...
Chevy Posted September 30, 2010 Author Share Posted September 30, 2010 Okay let me start over. I would really like for the routine to draw the tread and riser itself, but I think its way out of my league. I would like to pick 2 points, the floor to landing points. Then it change the riser height and draw the treads and risers from point to point. thats the principal but how? Where do i begin? The routine would need to have the riser height vary between 7" max and 6-3/8" min while keeping the 11" tread as a constant. I can do routines to manipulate commands but creating them myself, im still very very green. any thoughts? I like that routine Buzzard, the principal is right, just not the drawing. trd.dwg Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted September 30, 2010 Share Posted September 30, 2010 Okay let me start over. I would really like for the routine to draw the tread and riser itself, but I think its way out of my league. I would like to pick 2 points, the floor to landing points. Then it change the riser height and draw the treads and risers from point to point. thats the principal but how? Where do i begin? The routine would need to have the riser height vary between 7" max and 6-3/8" min while keeping the 11" tread as a constant. I can do routines to manipulate commands but creating them myself, im still very very green. any thoughts? I like that routine Buzzard, the principal is right, just not the drawing. [ATTACH]23396[/ATTACH] Sorry about that, It seems it may need to be custom written no matter what. I hope you find or get what you need. I will continue to look and see what available if its available. Quote Link to comment Share on other sites More sharing options...
JohnM Posted September 30, 2010 Share Posted September 30, 2010 Actually this sounds like a good project for you to learn with. If you can draw it and you know the math involved that’s half the battle. Could you post a drawing of what a finished drawing would look like? Quote Link to comment Share on other sites More sharing options...
Chevy Posted September 30, 2010 Author Share Posted September 30, 2010 Its attached on my last posting. Labeled trd.dwg. I thought it would be easy. But this has been my sore wound for a while. Since before i got laid off last time. Quote Link to comment Share on other sites More sharing options...
Chevy Posted September 30, 2010 Author Share Posted September 30, 2010 So if i want to get it to draw automatically then will i have to use vla functions? Well lets start of simple. I am guessing i will have to utilize the entmake function correct? Quote Link to comment Share on other sites More sharing options...
BlackBox Posted September 30, 2010 Share Posted September 30, 2010 So if i want to get it to draw automatically then will i have to use vla functions? Well lets start of simple. I am guessing i will have to utilize the entmake function correct? That is not necessarily true. You can absolutely start out with a routine using AutoCAD commands (._line, for example), and just feed those commands the criteria they need (i.e., start and end points for my previous example). Like JohnM says, you know how to draw what you want and the math needed... now just write the code (I know, easier said then done). I'm out of the office today, but I'll check back to see if I can help shortly. Hopefully someone else will be able to pitch in too. Good luck! Quote Link to comment Share on other sites More sharing options...
Chevy Posted September 30, 2010 Author Share Posted September 30, 2010 Thanks i will give it a go Quote Link to comment Share on other sites More sharing options...
JohnM Posted September 30, 2010 Share Posted September 30, 2010 It helps to plan it out on paper first in plain words and write out any math equations that will be used. I would use the pline command. Functions to look at: Polar Repeat Angle If Also be aware of turning the snaps on and off so when the program draws it will not snap to any points. Look at the undo command so if its not correct one undo erases everything that was just drawn. Quote Link to comment Share on other sites More sharing options...
Chevy Posted September 30, 2010 Author Share Posted September 30, 2010 Thanks John, I will post something in a bit. Hopefully it will work. Quote Link to comment Share on other sites More sharing options...
Chevy Posted September 30, 2010 Author Share Posted September 30, 2010 ok so how do i get the line to draw at an angle? Quote Link to comment Share on other sites More sharing options...
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.