CoCreate User Forum  

Go Back   CoCreate User Forum > Support > Customization

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 02-02-2004, 12:19 AM
jameshetfield jameshetfield is offline
Junior Member
 
Join Date: Jan 2004
Posts: 21
Lisp help needed

Hello evrybody!
I am a relatively new user to working on Lisp in CoCreate and i wanted some assistance for a particular problem.
I have been trying to generate a polygon with an arc on top,using parametric coordinates,i.e,say for eg.,i have n sides of a polygon,and i want an arc on top.The option i am looking to use for arc is "center",wherein i need to input the 2 end points of the arc parametrically (i dont know the coordinates).Does anybody have a function for this or any suggestions?

Eagerly waiting for a reply,
Bye
James
Reply With Quote
  #2  
Old 02-02-2004, 09:35 AM
John Scheffel's Avatar
John Scheffel John Scheffel is offline
Administrator
 
Join Date: Sep 2002
Location: San Jose, CA
Posts: 1,288
I don't have any LISP code to offer, but here are some tips that may help you.

You can use the unsupported Recorder function to record manual creation of your desired geometry and study it to see the functions and commands that were used. You can load the recorder with the command

(load "recorder")

This will add a button to your Toolbox to open a dialog which can be used to control the recorder. You can then use a text editor such as notepad to study the recorded files.

Once you know which functions and commands were run, you can also use the standard Windows Find/Search to find documentation on them. Right click on the "help" folder directly under the main Modeling install folder (OSD_Modeling_x.x.x.x) and select Find or Search. Then search for files containing the text string of the command.
__________________
John Scheffel
Reply With Quote
  #3  
Old 02-02-2004, 10:49 AM
Thom Ivancso's Avatar
Thom Ivancso Thom Ivancso is offline
Registered User
 
Join Date: Oct 2002
Location: Connecticut, USA
Posts: 212
How are you generating the polygon?

What information is required to be inputted by the user?

It sounds like you are looking to draw an arc from the polygon center going through two of the polygon circumference points.
Reply With Quote
  #4  
Old 02-02-2004, 09:06 PM
jameshetfield jameshetfield is offline
Junior Member
 
Join Date: Jan 2004
Posts: 21
Thanks Thom and John,but to reply to Thom:

The user input will be the dia,and the 2 end points (which i shall pick) of the polygon (say for eg., the 3 sides of a rectangle).
The code should take the center of the arc and create the arc. Hence i wanted something which would automatically take the center.

Any suggestions?
regards
james
Reply With Quote
  #5  
Old 02-02-2004, 09:59 PM
jameshetfield jameshetfield is offline
Junior Member
 
Join Date: Jan 2004
Posts: 21
John,
Is the "recorder" same as the record macro facility (Customize-New-Record)?
If it isn't please tell me how it works.I have loaded the dialog box into the toolbox using the command u gave, but how do u use the text editor? Could u please give me a procedure for it?

Thanks
James
Reply With Quote
  #6  
Old 02-03-2004, 06:27 AM
Andy Poulsen Andy Poulsen is offline
Administrator
 
Join Date: Apr 2003
Location: Fort Collins, Colorado
Posts: 273
Hi James,

The Recorder function is not quite the same as the Customize->New->Record. They both record commands, but the first is designed simply to capture the commands to a file (such as for programming help like John suggested), and the second is designed to automate a repetitive task and store those commands so they can be run by clicking on a toolbar button.

The Recorder function (in the toolbox) is most likely the one that would help you the most, as it will allow you simply to save the executed commands to a file. You choose a filename where you wanted the commands list to be stored, and click "Start", then click through the command sequence, and click "Stop", at which point the commands will be written into the file you chose at the beginning. You can then open this file from Windows explorer (for instance) using any text editor (such as Notepad, etc).

I am attaching a bit of code that should give you some ideas about how to accomplish what you wish. I have included many comments so you can know exactly what is happening, and have also put in some simple error checking that you may want to include (such as requiring the diameter to be at least as large as the distance between the points). I have set this up so that the arc will go counter-clockwise from the first point to the second so that it's always consistent (picking the points in the reverse order will change the direction of the arc).

Just load the attached lisp file into your OSD Modeling session. Save it to a known location on your hard drive first, and then do one of the following:

1. Simply drag the file from a windows explorer window into your OSDM session.

2. in the command line of your OSDM session, type (load "arc-sample.lsp") or (load "c:/temp/arc-sample.lsp") replacing "c:/temp" with the directory where you saved arc-sample.lsp (Note -- use the unix-standard forward slash "/" to separate directories rather than the windows-standard backslash "\" -- you'll get unexpected results if you don't).

3) in your OSDM session, click File->Load... Then browse to the directory where you saved arc-sample.lsp, set the file type to "Lisp Source (*.lsp)" select the file, and click "Load"

After the file is loaded there will be a new button called "Arc Sample" in your toolbox that you can play with to see how it works, and you can look at the lisp file using your favorite text editor as mentioned above.

Please let me know if you have any questions.

Good luck, and enjoy!

Andy
Attached Files
File Type: lsp arc-sample.lsp (3.4 KB, 376 views)
__________________
Andy Poulsen
AI MAXTools: Dream. Design. Done. It's that easy!
Add-ins bringing new functionality and speed to Creo Elements/Direct and CoCreate products. Now available for v17-v20+!
See them in action at www.ai-maxtools.com and then try them for yourself -- FREE!

Last edited by Andy Poulsen; 02-03-2004 at 06:36 AM.
Reply With Quote
  #7  
Old 02-03-2004, 11:54 PM
jameshetfield jameshetfield is offline
Junior Member
 
Join Date: Jan 2004
Posts: 21
Hello andy,
Thanks a lot for that info!..and the lisp works well.In fact,the code i have also does the same thing except constraining the dia to the dist b/w the 2 points (did not think of that!!!).

But in this particular process, the center position of the arc is dependent on the diameter value and the 2 points which are inputs. What if i need to keep the center at a predefined position?Not by coordinates,but in a function.

Lets say,I need to keep the center at a particular position.For eg., if i have 3 sides of a polygon and i need an arc joining the top 2 points of the open side,with the center at exactly half the dia value(y coord) and half the base width value(x coord),i.e,the total height of the profile would equal the diameter. Can i pass values like: center (/ width 2),(/ diameter 2).? What i am looking at is giving only the dia value; it should take the center automatically along with the end points.

Please suggest!
Bye
james
Reply With Quote
  #8  
Old 02-06-2004, 08:37 PM
jameshetfield jameshetfield is offline
Junior Member
 
Join Date: Jan 2004
Posts: 21
152 views and no one seems to be having any ideas for this!
anyways,thanks to all who've tried to help!I hope i get it someday.
regards,
james
Reply With Quote
  #9  
Old 02-09-2004, 07:23 AM
dorothea dorothea is offline
Registered User
 
Join Date: Nov 2002
Location: Nufringen near Stuttgart
Posts: 157
Hi James,

I have to admit that I didn't get the point, where the center should be. But if you just want to create a point out of (/ width 2) and (/ diameter 2) can can do it like this:

(setf center (make-gpnt2d :x (/ width 2) :y (/ diameter 2)))

For sure you first have to calculate 'width' and 'diameter'.

I don't know it this helps you at all. It was just a try.

Dorothea
Reply With Quote
  #10  
Old 02-09-2004, 09:41 PM
jameshetfield jameshetfield is offline
Junior Member
 
Join Date: Jan 2004
Posts: 21
Hi dorothea!
thanks for helping me out on this.This probably would work if i give the points also as inputs.But lets say, I need to define the 2 end points too (parametrically) in geometric terms, as in, in trigonometric functions (sine and cosine). Hence the only input would be the diameter and the function should automatically take the 2 end points and center and draw the arc. I hope i am clear.
Please tell me if u need clarifications.
Bye
james
Reply With Quote
  #11  
Old 02-09-2004, 09:51 PM
dorothea dorothea is offline
Registered User
 
Join Date: Nov 2002
Location: Nufringen near Stuttgart
Posts: 157
Hi James,

So this means you just have a diameter and a polygon? Could you please make a screenshot of the geometry you have and the desired resulting arc? This would help me understanding the problem.

Dorothea
Reply With Quote
  #12  
Old 02-09-2004, 11:55 PM
jameshetfield jameshetfield is offline
Junior Member
 
Join Date: Jan 2004
Posts: 21
Yes exactly!
As given in the image,i just have the polygon,and the arc on top which is getting connected by the 2 end points of the side arms. I have generated the polygon and am creating the arc by picking the points and entering a diameter value. I would like to give only the diameter and the function should automatically take the 2 end points and the center as defined geometrically,taking the dia equal to the total height of the profile.
Attached Files
File Type: zip geom1.zip (12.4 KB, 336 views)
Reply With Quote
  #13  
Old 02-10-2004, 12:26 AM
dorothea dorothea is offline
Registered User
 
Join Date: Nov 2002
Location: Nufringen near Stuttgart
Posts: 157
Hi James,

I hope the attached lisp file will bring you a step further to what you want.
Load the file and you'll get a button in the toolbox. The dialog demonstrates how to find the open ends of the polygon within the current wokplane. This way you should be able to avoid picking the open ends manually.
Can you get all other things out of the previous posted lisp file from Andy?

Dorothea
Attached Files
File Type: lsp find_vertex.lsp (982 Bytes, 363 views)
Reply With Quote
  #14  
Old 02-10-2004, 01:27 AM
jameshetfield jameshetfield is offline
Junior Member
 
Join Date: Jan 2004
Posts: 21
Hello dorothea,
Thanks for trying that out, but unfortunately, it doesn't really help me,cause the output is just that it highlights the open ends.Point is how do i integrate it with my lisp code at runtime?

What i need is a lisp syntax where i can trigonometrically define a particular point (say, the end of one of the side arms) in terms of the origin ,which is the lower left point of the horizontal line. I have the angle and the length of the side arm,i just need to define the coordinates of the end point in terms of sine and cosine,and pass it as parameters.Same with the other point,and the center (as defined by you).

Hope this helps to understand.
Regards,
james

P.S: I have tried using sine,cosine/asin,acos/asine,acosine,but nuthing really works.Actually speaking,i am not sure what's the correct syntax to be used for such kinds of definitions.
Reply With Quote
  #15  
Old 02-10-2004, 02:01 AM
Thom Ivancso's Avatar
Thom Ivancso Thom Ivancso is offline
Registered User
 
Join Date: Oct 2002
Location: Connecticut, USA
Posts: 212
Hello James,

Could you post the Lisp code you have written so far for generating the polygon?


Cheers
Thom
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 06:37 PM.



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.