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

Please help me with Visual Lisp in creating a 3d shaft

5 REPLIES 5
Reply
Message 1 of 6
crisloreine
598 Views, 5 Replies

Please help me with Visual Lisp in creating a 3d shaft

I am a begginer in this, I have a few knowledges about autocad but less about lisp.

I am using Autocad 2013 version.
I am working on a project(a little program) that creates a 3d shaft for a specific mechanical press. The program should ask the user some information (like the technical characteristics of the press) and behind the program it should dimension it. After asking the user if it is ok with him, it should generate the 3d model.
My question are how to start, where to start , should I start generating at first one shaft and use the line commands , or how to ?
I have a week in doing this and I am desperate.

 

 

Tags (2)
5 REPLIES 5
Message 2 of 6
hmsilva
in reply to: crisloreine


@crisloreine wrote:

I am a begginer in this, I have a few knowledges about autocad but less about lisp.

I am using Autocad 2013 version.
I am working on a project(a little program) that creates a 3d shaft for a specific mechanical press. The program should ask the user some information (like the technical characteristics of the press) and behind the program it should dimension it. After asking the user if it is ok with him, it should generate the 3d model.
My question are how to start, where to start , should I start generating at first one shaft and use the line commands , or how to ?
I have a week in doing this and I am desperate.

 

 


Hello crisloreine and welcome to the Autodesk Community!

 

To ask the user the information you need, see the getstring or getkword functions.

To create the 3d object, you can use Command calls, the vla-add method,...

If you attach a sample dwg will be easier to understand how complex is the 3D model you want to build.

 

HTH
Henrique

EESignature

Message 3 of 6
crisloreine
in reply to: hmsilva

Hello Henrique and thank you for your quick answer.

I will send you tomorrow an attachment with the drawing In order to make you understand what I am trying to do exacly. Just to explain it to you,I am trying to make a little program that can make 3d shafts for a specific kind pf mechanical presses (there are a few tipes in that category), and by that I tought that making one example can help me make it general .I don't know if you know how the geometry of a shaft for the press is generated , but through a little guide , only by entering some press technical characteristics (like the nominal force for example), you can obtain some dimensions. This is how I tought that I should do.

If you have a little sample of a program in autolisp that can help me, just to see how the programm lines are working I would be grateful to you. i learned a few syntaxes in college, but it was a simple sum or multiplication.

Again thank you for your answer.

Keep in touch,

Cristina

Message 4 of 6
hmsilva
in reply to: crisloreine

Hi Cristina,

my discipline is not mechanics, so I don't know how the geometry of a shaft for the press is generated...

 

A quick one, as a demo

 

(defun c:test ( / H PT R)
  (initget "10 20 30");; forces the anser to these values
  ;; sets the variable ans with the anser (user may enter only 1, 2 or 3 as a valid anser too
  (setq ans (getkword "\nEnter the press nominal force [10/20/30] <exit>: "))
  (cond	;; create a condition for the code pursue
	((= "10" ans);; if the anser is "10"
	 (setq pt '(0. 0. 0.);; sets the cylinder insertion point
	       r  10;; sets the cylinder radius
	       h  50;; sets the cylinder height
	 );; setq
	 (vl-cmdf "_.cylinder" pt r h);; uses the command cylinder to create the cylinder
	)
	((= "20" ans);; if the anser is "20"
	 (setq pt '(0. 0. 0.);; sets the cylinder insertion point
	       r  20;; sets the cylinder radius
	       h  100;; sets the cylinder height
	 );; setq
	 (vl-cmdf "_.cylinder" pt r h);; uses the command cylinder to create the cylinder
	)
	((= "30" ans);; if the anser is "30"
	 (setq pt '(0. 0. 0.);; sets the cylinder insertion point
	       r  30;; sets the cylinder radius
	       h  150;; sets the cylinder height
	 );; setq
	 (vl-cmdf "_.cylinder" pt r h);; uses the command cylinder to create the cylinder
	)
  );; cond
  (princ);; if the anser is enter or after creating a cylinder, exits quietly
);; test

HTH

Henrique

EESignature

Message 5 of 6
crisloreine
in reply to: crisloreine

Thank you for your help. What you sent to me was very useful.

Have a nice day!

Message 6 of 6
hmsilva
in reply to: crisloreine

You're welcome, Cristina
Glad i could help

Henrique

EESignature

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

Post to forums  

Autodesk Design & Make Report

”Boost