CoCreate User Forum  

Go Back   CoCreate User Forum > Support > Customization

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #16  
Old 02-10-2004, 03:14 AM
jameshetfield jameshetfield is offline
Junior Member
 
Join Date: Jan 2004
Posts: 21
Hi Thom,
I have attached the lisp file. Please go thru it. As u would see,i pick the points (point1 and point2) which are the end points for the 2 sidearms.The "point" is for the end of the horizontal base (cudn't find a way to do it automatically).I needed the dia input of the arc equal to the height of the profile which gets generated.

Thanks,
Regards
James
Attached Files
File Type: lsp runner8.lsp (6.4 KB, 274 views)
Reply With Quote
  #17  
Old 02-15-2004, 10:42 PM
jameshetfield jameshetfield is offline
Junior Member
 
Join Date: Jan 2004
Posts: 21
Hello Thom!
I attached the lisp code,but no one seems to have much time.
Am still expecting some help in this regard.
Regards,
james!
Reply With Quote
  #18  
Old 02-16-2004, 07:41 AM
Thom Ivancso's Avatar
Thom Ivancso Thom Ivancso is offline
Registered User
 
Join Date: Oct 2002
Location: Connecticut, USA
Posts: 212
Hello James,

Got your code and I am looking into it. I let you know if I come up with anything helpful.

Cheers
Thom
Reply With Quote
  #19  
Old 02-16-2004, 08:02 PM
jameshetfield jameshetfield is offline
Junior Member
 
Join Date: Jan 2004
Posts: 21
Thanks a lot Thom!
Am looking forward to hearing from you!
Regards,
James
Reply With Quote
  #20  
Old 02-21-2004, 04:26 AM
jameshetfield jameshetfield is offline
Junior Member
 
Join Date: Jan 2004
Posts: 21
Hello all!
no one seems to be having any ideas on this...this thread's going old..I, for one, am out of ideas.....
anyone out there trying it out?
PLease!
Thanks
james
Reply With Quote
  #21  
Old 02-24-2004, 04:02 PM
Thom Ivancso's Avatar
Thom Ivancso Thom Ivancso is offline
Registered User
 
Join Date: Oct 2002
Location: Connecticut, USA
Posts: 212
Hello James,

I have looked at your code and think I have found a way to find the two end points of the lines and the center of the diameter specified. It's got a good bit of math involved in it to make it work with your example.

The only problem I see with my solution is that your code allows for a user to technically make a straight line using three segments.

From your image posted you have a channel shape with an arc on it. Is this the only shape you want this lisp routine to create.

Also I noticed in running the code you place the first segment from 0,0 at a 0 degree to the length specified, then the second segment starts at 0,0 the new angle specified and then the length, the final segment is then open game to the user he can pick the 0,0 point again or the open end of the second segment or the open end point of the first segment.

This makes it hard to control the math to make the arc automatically using the end points and the arcs figured center point.

If I am incorrect with my thoughts on this please let me know.

If the routine had a little more control as to what the user can or can not input it might work better.

Hope this helps, I would need to clean up the code before I would send it to you. Let me know what you wish to do.

Cheers
Thom
Reply With Quote
  #22  
Old 02-24-2004, 07:39 PM
jameshetfield jameshetfield is offline
Junior Member
 
Join Date: Jan 2004
Posts: 21
Yes thom!
U're right.The way my code was working was actually because I did not know how to catch the end point of the first segment to be able to give the angle and length of the side arm.

Basically,with respect to the old code,what i was doing:
1.Defined an origin (which can be changed by picking up the point again).
2.Gave the length for the first segment.
3.Code then takes the origin and asks for angle and length of the side arm.
4.And then,I cudnt find a way to automatically pick the end point of the first segment,so i ask the user to pick the point,and then give the angle and length of side arm.
5.Same thing I do with the arc (Pick both end points and give the dia).

Now,What i wanted to do actually:
The only amount of "mousework" would be in the first step,i.e in picking any point for the origin.From then on,the inputs I would be giving would be:
1.Length of the base line and Angle and length of the sidearms.
2.The Diameter of the arc,the diameter being equal to the total height of the profile.

I do realise the amount of math involved,cause I too did a fair bit of the same,and thats why I wanted to know about the gonometric inputs within a function (sin,cosine,etc).But in any case,it would be nice if you could just tell me a little about the math u went thru,so that i cud compare it with mine.

....................................................................................................
If the routine had a little more control as to what the user can or can not input it might work better.
....................................................................................................

Could you please tell me what control were you trying to refer to here?

.....................................................................................................
Is this the only shape you want this lisp routine to create.
.....................................................................................................
For the moment,yes!..Of course seeing your code I shall learn a lot regarding defining functions and hence can work on more shapes and stuff.

I hope this helps.I'm thankful that you are still on it.Gives me lot of heart!!..
bye
Regards
James
Reply With Quote
  #23  
Old 02-29-2004, 08:15 PM
jameshetfield jameshetfield is offline
Junior Member
 
Join Date: Jan 2004
Posts: 21
Hello Thom!
Hopefully,something's coming up on the code.

If possible,could you please post your code so that I could try that out and then proceed further?

Regards,
James
Reply With Quote
  #24  
Old 03-02-2004, 09:22 AM
Thom Ivancso's Avatar
Thom Ivancso Thom Ivancso is offline
Registered User
 
Join Date: Oct 2002
Location: Connecticut, USA
Posts: 212
Hello James,

I have re-written the Lisp routine, please check it out.


Cheers
Thom
Attached Files
File Type: lsp runner.lsp (4.3 KB, 242 views)
Reply With Quote
  #25  
Old 03-03-2004, 03:48 AM
jameshetfield jameshetfield is offline
Junior Member
 
Join Date: Jan 2004
Posts: 21
Hello Thom!
The code works fine.There was a small correction which had to be made, but otherwise it works fine and it's given me a lot to learn,especially passing parameters.

Now,i just wanted to discuss on this,if it's ok:
What your code does is that it eliminates the input of diameter,which is why you took the coordinates of the center of the arc to be x: dist/2 :y 0. Let say,I need the diameter to be of some particular value;that means I dont have control over the position of the center right?
Please tell me if what I want is plausible:
I need to be able to input a dia value, as well as make the center to be defined at x: dist/2 y:dia/2. I am trying it out and shall tell you if i can do it. But please tell me if I can do it the way I have described?

Looking forward to your reply,

Bye and thanks,
Regards,
James
Reply With Quote
  #26  
Old 03-07-2004, 10:57 PM
jameshetfield jameshetfield is offline
Junior Member
 
Join Date: Jan 2004
Posts: 21
Hello thom!
As i mentioned in the previous post, I was trying to make a few modifications and i have attached a piece of lisp code for that.

What I am doing here is:

a) Eliminate control over the end points and the center of the arc. I am not defining them.

b) The only inputs I am providing is the arc dia and the angles of begin and end;essentially,i am using the "arc :cen_rad_ang" option to create the arc.

c) I am picking the center of the arc randomly anywhere in the active plane.

Now,while I am doing this, I am facing a problem:
When i measure the angles between the end points,the value does not correspond to the input I have given. I have tried to put in 80 and 100 degrees as start and end angles and the value between the end points comes to some other value (in decimals that too!),whereas,the value should be 20 degrees.

I have not found anything wrong in the code. Could you please go thru it and check it and tell me whats wrong?

Looking forward to a reply,
Thanks for your time!
James
Attached Files
File Type: lsp arc profile.lsp (2.3 KB, 235 views)
Reply With Quote
  #27  
Old 03-08-2004, 06:48 AM
dorothea dorothea is offline
Registered User
 
Join Date: Nov 2002
Location: Nufringen near Stuttgart
Posts: 157
Hi James,

I have more a general comment than a particular fix for your problem.

When writing your own code you have to work with INTERNAL units. The developers kit always works with these units. The system does the conversion from user units to internal units for you. Especially when working with angles you'll run into problems because the user units are often degree and the internal units are radian.
You specify the value type of a variable defining an angle as :positive-length. This means you have to perform the units conversion by yourself. When you call the 'arc' dialog you have to pass the values in radian.

Other possibility is to use the build in conversion as I mentioned before. Just change the value-type to :angle.

Please check also the documentation:
help/Common/documentation/integration_kit/reference/dg_manual.html#numbers



Dorothea
Reply With Quote
  #28  
Old 03-08-2004, 07:39 PM
jameshetfield jameshetfield is offline
Junior Member
 
Join Date: Jan 2004
Posts: 21
Thanks a lot dorothea!
I completely overlooked the "value-type ositive-length" part in the code!!...brain-clouds form too often nowadays.. ....
Anyways,thanks again for that tip!! I am trying out a creation of a profile,and I hope I can turn to experts like you whenever I face a problem, 'cause, I am learning CoCreate Lisp on my own,and I dont have any other resource than this forum and the help maunals.

Of course,if someone could tell me how's the correct manner to go through the manual,it will save a lot of time.

Expecting a reply soon,
Regards,
James
Reply With Quote
  #29  
Old 03-09-2004, 12:21 AM
jameshetfield jameshetfield is offline
Junior Member
 
Join Date: Jan 2004
Posts: 21
Hello Dorothea!
As i had said, I have been trying out a profile creation in cocreate lisp. I have run into an issue again, and I have attached the code for you to check:

Just for your info, P1 and P4 are the points on the right side of the vertical construction line, and P2 and P3 are the points on the left side. I have defined the points trigonometrically, but somehow when I am creating a line between P2 and P3, it is not catching P2. There's nothing wrong with the logic (as i see it now),cause it catches P1 and P3 and forms a line. Dont know why it does not catch P2 .

Also, I tried mirror option,but I am not sure about the syntax.What I did was:
(defun draw-profile()
(let ((rad (/ dia 2)))
(sd-call-cmds (arc :cen_rad_ang 0,0 rad ang1 ang2))
(sd-call-cmds (c_line_inf :vertical 0,0))
(setq l1 (c_line_inf :vertical 0,0))
(sd-call-cmds (c_line_inf :horizontal 0,0))
(setq p5 (make-gpnt2d :x 0 :y (-(/ dia 2))))
(sd-call-cmds (c_line_inf :horizontal p5))

(setq sin_p1 (sin ang1))
(setq cos_p1 (cos ang1))
(setq x_p1 (* rad cos_p1))
(setq y_p1 (* rad sin_p1))
(setq p1 (make-gpnt2d :x x_p1 :y y_p1))
(setq p4 (make-gpnt2d :x dia :y (- rad)))
(sd-call-cmds (line :two_points p1 p4))
(setq l2 (line :two_points p1 p4))

(mirror_2d l2 :horizontal l1 :repeat_factor 1 :keep n)
)

)

Whats going wrong?
Looking forward to a reply,
Regards,
James
Attached Files
File Type: lsp arc profile 2.lsp (3.2 KB, 226 views)
Reply With Quote
  #30  
Old 03-15-2004, 09:22 PM
dorothea dorothea is offline
Registered User
 
Join Date: Nov 2002
Location: Nufringen near Stuttgart
Posts: 157
Hi James,

I will not fix any of your mathematical calculation because I don't understand what's going on. Where I can help you is only finding problems in coding if they are of general nature.

As I said in my previous reply, the program internally works with internal units and not with user units. This includes RADIAN for ANGLE.
You write in your code
(setq sin_p2 (sin (- 180 ang2)))
Do you mean PI instead of 180 degree?

What did you mean with the posted code in the text? Where is the problem, or what doesn't work? I only had a look into the attached lisp file.
And there I saw that you do not declare all used variables. What about for instance ang1 or sin_p1? You assign values in the dialog and/or function but are they supposed to have global influence or should they just be local variables? This might lead to problems because you change the value of such variables without knowing it.


Hope this helps,
Dorothea
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 02:10 AM.



Hosted by SureServer    Forums   Modeling FAQ   Macro Site   Vendor/Contractors   Software Resellers   CoCreate   Gallery   Home   Board Members   Regional User Groups  By-Laws  

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.