PDA

View Full Version : Routine to draw Objects via a set of guidelines



tany0070
2007-03-12, 07:31 AM
hi all, i have a problem and i really need help, it's kind of hard to explain it clearly so if anyone who does not understand what i'm asking do feel free to reply with questions. ok so what i need help in is to write a module that draws out objects in the form of multiple lines connected together to form a shape, there are guidelines to tell where the lines are to turn and bend but these are also computer generated and coordinates are not given in files. i have attached 2 files showing the start and end of the module, please help. thank you.

.T.
2007-03-14, 01:20 AM
hi all, it seems that this thread is not very active so i thought i post again to seek help. if anyone has any ideas as to how i could do this please help as i am running out of ideas as how i can do this. thanks

Is there any way you can post the guidlines that define the geometry? I can't make heads, nor tails out of what you are trying to do with the information given. From your pictures (maybe a sample dwg would be better), it looks like the "fingers" all have the same short segment, then they all point to some common point on the vertical axis in the negative y direction, but I can't be sure.

tany0070
2007-03-14, 01:32 AM
the guidelines are actually the yellow colored box (not the square one though) and the white rectangular boxes. the yellow box define where the horizontal changes (like where the line bents etc) where as the white rectangular boxes define the width of the horizontal lines and location (where the top horizontal line is). thanks

.T.
2007-03-14, 06:06 AM
the guidelines are actually the yellow colored box (not the square one though) and the white rectangular boxes. the yellow box define where the horizontal changes (like where the line bents etc) where as the white rectangular boxes define the width of the horizontal lines and location (where the top horizontal line is). thanks

OK, where is your starting point? The intersections of the two centerlines? If so, you can draw the shape by using polar to calculate the points, then pline them in like (guessing that you are using the code I posted to get the intersection of the centerlines):

The syntax of POLAR is (polar from_point angle_in_radians distance), so and I am calling the intersection of the two centerlines intpt.



(setq pt1 (polar intpt (* 0.5 pi) 1.0)
pt2 (polar pt1 (* 0.5 pi) 0.5)
pt3 (polar pt2 0.0 1.0)
pt4 (polar pt3 (* 1.5 pi) 0.1875)
pt5 (polar pt1 0.0 0.75)
)
(command "._pline" pt1 pt2 pt3 pt4 pt5 "c")


I am just guessing at the distances since you have not provided them. Adjust to what you need.

tany0070
2007-03-14, 06:28 AM
OK, where is your starting point? The intersections of the two centerlines? If so, you can draw the shape by using polar to calculate the points, then pline them in like (guessing that you are using the code I posted to get the intersection of the centerlines):

The syntax of POLAR is (polar from_point angle_in_radians distance), so and I am calling the intersection of the two centerlines intpt.



(setq pt1 (polar intpt (* 0.5 pi) 1.0)
pt2 (polar pt1 (* 0.5 pi) 0.5)
pt3 (polar pt2 0.0 1.0)
pt4 (polar pt3 (* 1.5 pi) 0.1875)
pt5 (polar pt1 0.0 0.75)
)
(command "._pline" pt1 pt2 pt3 pt4 pt5 "c")


I am just guessing at the distances since you have not provided them. Adjust to what you need.
thanks. oh and the code i'm writing is for a general case so it is suppose to work on any drawings that is of that sort, that's why i left out the distances of the objects out of the thread. oh and before i forget thanks again for the intercept coding help you gave.

tany0070
2007-03-14, 06:36 AM
oh may i ask if anyone also knows how to find the distance of either the length or width of a rectangle? i just discovered that the while rectangles in the drawing are not drawn using multiple lines but one single entity, and i need the width, especially to determine the width of my to-be-drawn object. thanks

kennet.sjoberg
2007-03-14, 07:11 AM
I am just curios tany0070, are you a student or an employer ?

: ) Happy Computing !

kennet

tany0070
2007-03-14, 07:33 AM
I am just curios tany0070, are you a student or an employer ?

: ) Happy Computing !

kennet
undergrad. y??

kennet.sjoberg
2007-03-14, 10:47 AM
I am just curios tany0070, are you a student or an employer ?

undergrad. y??

It will of curse affect prioritise to my answers.

I am a very busy employer and I am not willing to waste my time when the [F1] button can do the job.
But as you can see I have spent a lot of time there I know I can get something back someday when I need the help myself . . .
and that it the point of a guild.


: ) Happy Computing !

kennet

.T.
2007-03-14, 03:52 PM
the code i'm writing is for a general case so it is suppose to work on any drawings that is of that sort, that's why i left out the distances of the objects out of the thread.

Wouldn't a dynamic block or block library be better for this? You only need to draw it once, then it can be used over and over. If this geometry is to be used in several drawings I would look at doing it that way instead of trying to "draw" them using lisp. It's a lot easier.

How much of the geometry changes from one drawing to another?

tedg
2007-03-14, 04:03 PM
Wouldn't a dynamic block or block library be better for this? You only need to draw it once, then it can be used over and over. If this geometry is to be used in several drawings I would look at doing it that way instead of trying to "draw" them using lisp. It's a lot easier.

How much of the geometry changes from one drawing to another?With out knowing too much about this, only the threads I've read, a DB would be a good idea.
It sounds like there's information to be inputted that could be done in a "look up" function in a DB.

Is this to be used in AutoCAD 2006 or higher?

:?

tany0070
2007-03-15, 12:53 AM
It will of curse affect prioritise to my answers.

I am a very busy employer and I am not willing to waste my time when the [F1] button can do the job.
But as you can see I have spent a lot of time there I know I can get something back someday when I need the help myself . . .
and that it the point of a guild.


: ) Happy Computing !

kennet
i see, but please understand my intentions of posting questions that may by in the HELP menu. i am currently ATTACHED to a company for internship and am writing a program for them as a project, it is due by june. so i post question to seek help but at the same time still go through other forums/help menu to see if i could solve the problem myself. if i do manage to solve it, i would still compare it to any help given by pple in this forum and see how i could better improve the coding. plus i am very very new to writing programs with lisp (only 3 months since i first started use) and i am not fully familiarized with what and where the answers to my questions are in the help menu. please understand and thank you.

tany0070
2007-03-15, 01:00 AM
Wouldn't a dynamic block or block library be better for this? You only need to draw it once, then it can be used over and over. If this geometry is to be used in several drawings I would look at doing it that way instead of trying to "draw" them using lisp. It's a lot easier.

How much of the geometry changes from one drawing to another?
would it? from what i understand/know the guidelines may differ for each different drawing, that's why i thought if i am able to draw out the items with lisp by using the guidelines, it would be better as it would fit into the guidelines more perfectly. but thanks for the idea, will seek advise from higher ups to see if it is usable in my program. thanks again.

tany0070
2007-03-15, 01:15 AM
With out knowing too much about this, only the threads I've read, a DB would be a good idea.
It sounds like there's information to be inputted that could be done in a "look up" function in a DB.

Is this to be used in AutoCAD 2006 or higher?

:?
i see, oh and i am programming with 2004 but it think it is for use with 2004 and above. thanks

.T.
2007-03-15, 01:21 AM
would it? from what i understand/know the guidelines may differ for each different drawing, that's why i thought if i am able to draw out the items with lisp by using the guidelines, it would be better as it would fit into the guidelines more perfectly. but thanks for the idea, will seek advise from higher ups to see if it is usable in my program. thanks again.

It's good to keep an open mind towards ALL of the tools available. Blocks and Dynamic Blocks are a couple of those tools.

The problem I'm having is trying to figure out what the parameters are for what you are trying to draw; they are just too vague. And not being in your field makes it very difficult to get an idea of how to proceed.

I guess the questions to ask would be: How many types of these widgets are there, and what changes between each type? What are the constants and what are the variables?

tany0070
2007-03-15, 01:42 AM
It's good to keep an open mind towards ALL of the tools available. Blocks and Dynamic Blocks are a couple of those tools.

The problem I'm having is trying to figure out what the parameters are for what you are trying to draw; they are just too vague. And not being in your field makes it very difficult to get an idea of how to proceed.

I guess the questions to ask would be: How many types of these widgets are there, and what changes between each type? What are the constants and what are the variables?
ok i see, first you see the yellow non-square look object? that is the guideline in question and i'll be using that as reference to plot out the teeth-like objects, they determine where the lines y-axis locations are and also where the lines will bend or turn. the rectangular like items directly above the yellow shape guidelines will define where the first set of horizontal lines' x-axis values will be at, the preceeding values will depend on how many teeth-like objects will be drawn, usually also determined by the number of white rectangles above the guidelines. the width at the final line (nearest line to the yellow square) is a user given value. so coding will evaluate how wide apart from each other the teeth-like objects are, the gap is equal and plot out the lines. something like that i guess, maybe i will repost this again when i am able to think up a better way of explaining this. thank you.