Skip to main content
2-Explorer
January 19, 2017
Question

Feature copy from one file to other file

  • January 19, 2017
  • 6 replies
  • 3031 views

Hello

I have a sketch in one part file and same I would like to use into other part file.

I am following below steps:

  1. Get Feature handler of sketch from first file
  2. Use API ProFeatureSectionCopy() to get handler of section
  3. Define element tree for new sketch into second part
  4. Set value of element "PRO_E_SKETCHER " from section retrieved in step 2
  5. Create feature

I am not able to get all the entities into new sketch feature all the times. Even though some times I get entities, sketch is not fully placed due to changed references.

Any thought on same will be of great help.

Thanks in advance!

Regards

Ketan

6 replies

17-Peridot
January 19, 2017

It should be a lot simpler to copy sketches, but it's not.

Most of us do not take the time to make sketches "independent".

For sketches to be useful as library items, they need only 2 constraints to tie it to the universe since the 3rd is the sketch plane.

This is not how we think or use sketches normally, so it does take extra effort to copy it.

To make use of the existing sketches:

In the original file, open the sketch and delete the references.

Rebuild the sketch so it is self-constrained and you can move it around without it blowing up.

Now save the section file.

Quit the part and erase in memory so no unintentional updates remain.

There may be other ways like copy and paste, but I don't run into this often enough.

If I need to reuse the same thing over and over, I will make a palette sketch specifically to do what I need.

2-Explorer
January 19, 2017

I may be asking very basic question, but could you please let me know more about palette sketch?

17-Peridot
January 19, 2017

The palette sketch is a place where you can organize your section files.

These files show up in the sketcher palette once properly located.

It sounds like you are working on the programming end.

You might see if the sketcher palette is useful in programming.

1-Visitor
January 19, 2017

If you want to reuse features from one part to another, then it's very possible, although Creo user interface often tries hard to make it difficult

This is what I do:

Activate the window of the source part.  Make it 1/2 screen size (use the Windows + left arrow key).

Select the feature(s) you want to copy.  CTRL+C to copy, or click the icon in Model tab/Operations/Copy.  (incidentally, if for some reason you can't copy them the icon will be grayed out).

Activate the window of the target part.  Make it 1/2 screen size such that you can see the source (use Windows+ right arrow key).

Now use the "paste special" command (Model tab/Operations/Paste->Paste Special).  Use the "Advanced reference configuration" option.

The rest is basically specifying the feature references in the target part that correspond to the references in the source part.

(the window resizing is necessary to be able to see the source and target parts simultaneously.  Also, often the Advanced Reference Configuration dialog box can get lost behind other windows, and that one does not show up in the taskbar - but it does show up in the task manager!)