Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
Hi Community,
I'm a very beginner of Pro/Toolkit and try to make a program that creates a new 3D part in Creo 4.0.
I have a file that indicate crosssectional plane shape points and the program should read the file, make sketch from the points, and create solid by rotating/exluding the sketch.
I'd like to make it in asynchronous mode, so it will contain functions below:
1) Read file and extract shape points
2) Start/Connect Creo
3) Open new PART
4) Select a datum plane(like "FRONT" plane)
5) Draw sketch on the plane form shape points
6) Select datum plane/axis as reference
7) Exlude/rotate to make solid
I tried ProSolidMdlnameCreate() method for function 3) but noting shown in my display even the program returns no error.
Could you show me how to open a new PART file with default template?
Thanks!
Solved! Go to Solution.
Based on your ideas, this is probably the easiest task, but even this, is a little bit tricky in Creo, but can be done in a-sync Mode.
After you have created the model by name and type, you have it only in memory but not displayed. Now try to call this:
Now the Window is still not active, like in standard Creo and to create a sketch it may even not needed, you need only a graphic window, but just to activate, you can now fire a mapkey, because you are in a-sync mode.
ProMacroLoad( L"~ Command `ProCmdWinActivate`;" );
Probably you should sleep now a couple of milli seconds before continue.
To create your sketch or the protrusion, this is much more fun 😎
Note: Instead doing this calls to create a model from template, for a solid you can copy a model to your required name on disk and just open this one.
Have you tried a ProMdlDisplay(mdl) to display the model? I have no experience with asynchronous mode so Im not sure how Creo windows behave in that situation, but you might also want to look into ProObjectwindowMdlnameCreate if there is no active window.
Based on your ideas, this is probably the easiest task, but even this, is a little bit tricky in Creo, but can be done in a-sync Mode.
After you have created the model by name and type, you have it only in memory but not displayed. Now try to call this:
Now the Window is still not active, like in standard Creo and to create a sketch it may even not needed, you need only a graphic window, but just to activate, you can now fire a mapkey, because you are in a-sync mode.
ProMacroLoad( L"~ Command `ProCmdWinActivate`;" );
Probably you should sleep now a couple of milli seconds before continue.
To create your sketch or the protrusion, this is much more fun 😎
Note: Instead doing this calls to create a model from template, for a solid you can copy a model to your required name on disk and just open this one.
Rather to do a sketch, create an UDF. This UDF is a protrusion using a curve through points created by an ibl, pts file like CS213210 . I hope the file name can be configured during UDF placement, I did not test this. If this is not working, try a mapkey for this requirement.
If you do a sketch, you may in trouble to solve a lot of items, but it’s up to you, only a guess.