Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Automated drawing using input data -LISP code

18 REPLIES 18
SOLVED
Reply
Message 1 of 19
abdulhasiin
3684 Views, 18 Replies

Automated drawing using input data -LISP code

I would like to automate drawing process for certain data. Using some LISP codes User will be asked to provide some data and using that data an automatic drawing needed to be developed at Drawing editor of AutoCAD. For example;

Enter the width of Sheet: 50 mm
enter the length of Sheet: 200 mm
Enter the sheet thickness: 5mm
Enter type of feed: Automatic
Are there holes in Strip: Yes/No
Specify nu of holes: 5
Position of holes Centre: 5,5
Distance between the holes:  At an interval of 20mm each

I just need a LISP code for such program.

Thaks in Advance

18 REPLIES 18
Message 2 of 19
3wood
in reply to: abdulhasiin

It looks dynamic blocks can do the job.

Message 3 of 19
abdulhasiin
in reply to: 3wood

In dynamic block we need to define attributes. But in my project I want to automate drawing process using command window. As I mentioned earlier, using various inputs at command prompt the module (code) have to generate drawing. Is it possible? If it is, How I need to proceed? 

Message 4 of 19
3wood
in reply to: abdulhasiin

There are bunch of lisp functions to accept user inputs, such as getstring, getint, getkword, etc. You may need start from there.

Message 5 of 19
abdulhasiin
in reply to: abdulhasiin

By starting point i meant the function that can automate the drawing process instead of displaying output at command window. What combinations I should use with "princ" to display the drawing made from user inputs at Drawing Area of AutoCAD.

Message 6 of 19
Kycau
in reply to: abdulhasiin

I'm not a por at AutoLisp, but I would give it a try to make the program for you.

If it's not an urgent task of course ) 

If you are interested in, write me a private message, and we'll discuss the details 🙂

Message 7 of 19
Kycau
in reply to: 3wood


@3wood wrote:

It looks dynamic blocks can do the job.



abdulhasiin wrote:

Distance between the holes:  At an interval of 20mm each



I suppose this deature should be realized by "array" action in a dynamic block.

But as far as I am concerned, there is no posibility for dynamic input for the array factor. once you add "array" action to a parameter, you are promted with:

"Enter the distance between columns (|||): ".

Once you enter a value, you can't change it dynamically.

 

Am I missing smth. ?

Is there a possibility to make the "array distance value" dynamically changeable ?

Message 8 of 19
hmsilva
in reply to: abdulhasiin


@abdulhasiin wrote:

I would like to automate drawing process for certain data. Using some LISP codes User will be asked to provide some data and using that data an automatic drawing needed to be developed at Drawing editor of AutoCAD. For example;

Enter the width of Sheet: 50 mm
enter the length of Sheet: 200 mm
Enter the sheet thickness: 5mm
Enter type of feed: Automatic
Are there holes in Strip: Yes/No
Specify nu of holes: 5
Position of holes Centre: 5,5
Distance between the holes:  At an interval of 20mm each

I just need a LISP code for such program.

Thaks in Advance


 

abdulhasiin,

Could you attach a sample DWG?

 

Henrique

EESignature

Message 9 of 19
abdulhasiin
in reply to: hmsilva

I was just waiting for your comment Henrique 🙂 

Sure, Actually there's no particular type of sample that can be made. the drawing will be based on the user inputs. Go through these pics. I Hope it will be helpful.

Example Input Data (User Interface)
original.jpg


And Using these user inputs A diagram as shown below will be generated at drawing area of AutoCAD

1.JPG

Message 10 of 19
abdulhasiin
in reply to: abdulhasiin

This the component for which the above drawing was made.
2.JPG

Message 11 of 19
Kycau
in reply to: abdulhasiin

there is still not enoush data for making the lisp routine.

Make an exemple for:

Enter the width of Sheet: 50 mm
enter the length of Sheet: 200 mm
Enter the sheet thickness: 5mm
Enter type of feed: Automatic
Are there holes in Strip: Yes/No
Specify nu of holes: 5
Position of holes Centre: 5,5
Distance between the holes:  At an interval of 20mm each

 

-----------------------

 

Enter the width of Sheet: 35 mm
enter the length of Sheet: 150 mm
Enter the sheet thickness: 5mm
Enter type of feed: Manual
Are there holes in Strip: Yes/No
Specify nu of holes: 0
Position of holes Centre: -
Distance between the holes: -

 

----------------------------------------------

 

Enter the width of Sheet: 75 mm
enter the length of Sheet: 150 mm
Enter the sheet thickness: 5mm
Enter type of feed: automatic
Are there holes in Strip: Yes/No
Specify nu of holes: 1
Position of holes Centre: 10
Distance between the holes: -

 

I think that will should be enought to create a routine, tha would act correctly for any user input.

Message 12 of 19
hmsilva
in reply to: abdulhasiin

Haseeb,

when I asked to attach a dwg, It was because I did not understand what you were trying to draw through lisp, now I see that your new project is huge. Let's start with something smaller, and then you can develop something bigger...

 

As 3wood already said, you need to start from getint, getkword, etc.

 

From msg #1

 

Enter the width of Sheet: 50 mm

enter the length of Sheet: 200 mm

Enter the sheet thickness: 5mm

Enter type of feed: Automatic

Are there holes in Strip: Yes/No

Specify nu of holes: 5

Position of holes Centre: 5,5

Distance between the holes:  At an interval of 20mm each

 

Can you attach a dwg with what you expect to get Using this input?

It's easier to understand if more input is need, to achieve the result you wish to...

 

Henrique

EESignature

Message 13 of 19
abdulhasiin
in reply to: hmsilva

Actually, I post that images just to elaborate my idea for the project. And that message#1 was also an example to describe the expected inputs/output. Okay, here I'm posting the real one. Its not something huge, just an average one. Have a look,

The sample componenet(Fig.1) for which I want to generate a strip layout (Fig.2).
Capture.JPG

                                                                               Fig.1 Example component 

Strip Layout.PNG

                                                                                              Fig.2 Expected out put

That poly lines at the extreme right can be neglected. a complete rectangle is also acceptable. And for this output, the expected input was there in message#1. I Hope, Now It make sense.
Henrqiue, I know how to start but the main problem I'm facing in this project is in automating drawing process. Its going well since the last but one step in LISP. but I'm failing continuously  at the last stage i.e. in automatic generation of drawing. I just need the routine that can automate the drawing process. I Hope its crystal clear now 🙂
And Thanks once again for your efforts.

Regards: 
Haseeb

Message 14 of 19
hmsilva
in reply to: abdulhasiin

Haseeb,

I'm not a "mechanical" guy, my world is "architecture", that's why I asked for a dwg.

As you have said:

 

"I know how to start but the main problem I'm facing in this project is in automating drawing process"

 

Attached is a demo (only a portion of your drawing), which serves to demonstrate a possible way to automating drawing process, only uses AutoCAD commands, you should also look at vla-add method and entmake, these processes are faster and not have to deal with osnap issues.

 

Hope that helps

Henrique

EESignature

Message 15 of 19
abdulhasiin
in reply to: Kycau

Thanks a lot Henrique.

With your code many of my doubts get cleared. I'm trying to write a code with my requirments using your code as a base. I'll update you soon with my code. But Here with your code, during execution It showing "Invalid Window Specification". I Tried to debug but no use. Can you please try to explain why its showing that error message.

Regards:

Haseeb 

Message 16 of 19
hmsilva
in reply to: abdulhasiin

Haseeb,

I can not replicate your error, attached is a demo slightly different from the previous one, also attached a copy from the AutoCAD text window with the command echo from the "test" routine, in order to compare with your echo, and a dwg resulting from demo...

 

Hope that helps

Henrique

EESignature

Message 17 of 19
abdulhasiin
in reply to: hmsilva

Thanks a lot Henrique. Your code is Perfect. I'll update it for the complete project. All my doubts are clarified now. Thanks again. 

Good wishes always 🙂

Regards 
Haseeb

Message 18 of 19
hmsilva
in reply to: abdulhasiin

You're welcome, Haseeb
Glad I could help

Henrique

EESignature

Message 19 of 19
abdulhasiin
in reply to: hmsilva

Yes, And Its the second time 🙂

Thank you very much

Haseeb

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost