cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

ProDimensionCanRegen in Creo3

SOLVED
msteffke
Amethyst

ProDimensionCanRegen in Creo3

Cannot get the function to return anything but -8.   There is an SPR 4887879 on this but I still get the same bad results after updating from Creo3 m30 to m100, then again to m110.

Called during visit action, I am using several other proDimension functions with good results, so I'm confident my arguments are legit. 

ProDimension **dims = (ProDimension**)data;

ProBoolean CanRegen;

status = ProDimensionCanRegen((ProDimension*)dimension, &CanRegen);

So my questions:

1.  Has anyone got this function to Work in Creo 3?

2. When there is an spr related to code, I imagine you should recompile after your upgrade? Did that.

3.  When you upgrade creo 3, does it actually go in and replace the toolkit API source files?  I did check the toolkit box.  Or do you feel the need to just wipe out the old version and install clean? 


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
1 ACCEPTED SOLUTION

Accepted Solutions

Re: ProDimensionCanRegen in Creo3

Presuming you want to skip the feature dims, and that you'd want to skip driven dimensionsmade in an entirely different drawing which cannot be shown in your target drawing, you can skip that and just use ProDimensionCanRegenerate(p_dim, p_draw, &can_regen) 's return value (both will give PRO_TK_BAD_CONTEXT).

To the license issue... though it seems strange for a dimension in 2d to be requiring this, I don't think I can address whether a license requirement for a Toolkit API that replaced a Pro/DEVELOP API is justified in a forum discussion.  Please file an SPR, saying that you could do this with the Pro/DEVELOP function and basic TK license, and you hope/expect to be able to do the same action in the new release without an additional license, and I'll refer it to the right person.

View solution in original post

13 REPLIES 13

Re: ProDimensionCanRegen in Creo3

Matt,

The function ProDimensionCanRegen is obsolete.

You should be using ProDimensionCanRegenerate((ProDimension*)dimension, NULL, &CanRegen);

HIH.

Feliks.

mender
Regular Member
(in response to FV)

Re: ProDimensionCanRegen in Creo3

Some clarification on that:  ProDimensionCanRegenerate was introduced in Creo 3 M080 to cover the case of a driven dimension which lives in a solid model, but the query is being made in the context of a drawing.  ProDimensionCanRegen(dim, &can_regen) is equivalent to ProDimensionCanRegenerate(dim, NULL, &can_regen).  This probably is relevant to your situation, if you are passing a driven dimension made from drawing mode and owned by a solid, which can only be displayed in the context of this drawing, as PRO_TK_BAD_CONTEXT includes the case where the dimension cannot be displayed in the context.  With ProDimensionCanRegen, the context is the owning solid.

Short form, as FV said, except use the drawing instead of NULL.

If this isn't relevant (you aren't trying to ask about a dimension owned by a solid, but in the context of a drawing), some additional details could be useful.

Re: ProDimensionCanRegen in Creo3

Well what you are saying is definitely barking up the right tree.  This is indeed a drawing dimension, whose owner is the solid, not the drawing.   Maybe my problem is the dimensions I'm testing are not driven.    What determines if a dimension is driven?

The dimemsion I'm testing is the length of a feature, lets say a cut.   If there is a parameter that turns this cut off,  The dimension becomes magenta in the drawing.  It that dimension considered driven?   

Re: ProDimensionCanRegen in Creo3

A dimension which can 'become magenta' is driven, because that is the indication of a driven dimension failing regeneration.  The quick and dirty way to see if a dimension is driven or driving is to look at its name (if you haven't changed it):  d# is a driving (feature) dimension, ad# is driven.  (add is draft, od is ordinate).  A driving/feature dimension is one made by a feature, which gives instructions on how to make the geometry.  A driven dimension is made by the user, which makes and reports a measurement.

So, confirming the dim you have is driven, and looks like the desired syntax is (in Creo 3 M080 or later) ProDimensionCanRegenerate(solid, drawing, &can_regen).

Re: ProDimensionCanRegen in Creo3

I'd say my dimension is driven.    I created a circular cut feature in the existing model.   Then I went into the drawing and created a dimension that measured from the edge of the part to the center of the circle cut.    I then  suppressed the circle cut, came back into the drawing and that dimension was magenta.  its id is #ad127.    But is that the same as Rel_driven?   There's really no relation controlling that.   Rel_driven seems to be the only thing that can be checked.

Re: ProDimensionCanRegen in Creo3

It sounds like you haven't tried the syntax I provided, and I would recommend you do that.  Yes, your dimension is a driven dimension, sometimes called a created dimension.  No, this is not the same as 'a feature dimension whose value is driven/computed by a relation'.  I have no idea what you are referring to with 'Rel_driven seems to be the only thing that can be checked.' and it sounds unrelated to the question of ProDimensionCanRegen(erate) which is about driven/created dimensions, not feature/driving dimensions.

Re: ProDimensionCanRegen in Creo3

A side note for someone reading this thread who isn't on Creo 3.  In older versions, please use prodim_can_regen_driven_dim() to get the desired functionality.

Re: ProDimensionCanRegen in Creo3

That's where this all came from.  I am converting this from a wildfire version to CREO3.  The original version I wrote 10 years ago was using prodim_can_regen_driven_dim().   The old code  was so simplistic and took 3 calls to accomplish what I needed.    What I have figured out today is that with ProDimensionCanRegenerate, if you pass a not driven dimension you get a -8.   So I need to be filtering the dimensions ProDimensionIsReldriven before checking if they can regen. 

The old develop Code:

ndim = prodim_get_dim_ids(models[0], PRO_DIM_PARAM , PRODIM_ATTR_DRIVEN |

  PRODIM_ATTR_VIS_IN_DWG_ONLY, &dim_array);

for (dim_id = 0; dim_id < ndim; dim_id++)

  {

n = prodim_get_dimension(models[0], dim_array[dim_id], PRO_DIM_PARAM,&dim);

n = prodim_can_regen_driven_dim(models[0], p_draw, dim_array[dim_id],PRO_DIM_PARAM);

Re: ProDimensionCanRegen in Creo3

ProDimensionIsReldriven detects feature dimensions whose values are not directly set by the user, but are computed by a relation.  It is not what you want.

ProSolidDimensionVisit(models[0], PRO_B_FALSE, act_on_dimensions, NULLFN, p_draw)

act_on_dimensoins(ProDimension *dim, ProError status, ProAppData p_draw)

{

if (ProDimensionIsDriving(dim, &is_driving) != PRO_TK_NO_ERROR || is_driving)

  /* with driving dims, what do you want to do?  Also note if the answer is 'skip them', you could put this in the filter function. */

else

  {

   /* Okay, we have a driven dimension. */

   if (ProDimensionCanRegenerate(p_dim, p_draw, &can_regen) != PRO_TK_NO_ERROR)

    /* This dimension can't even be shown in this drawing */

   else if (!can_regen)

    /* We can't regen it */

   else

     /* We can regen it */

  }
}

This can be simplified a bit if you don't care about separate behavior for all the cases noted.

Re: ProDimensionCanRegen in Creo3

I see what you are saying.  I tried to use this isdriving, function weeks ago,  but it brings up a licensing requirement warning, and we do not have toolkit for 3d drawings.   I cannot check this with the standard toolkit license?  But I used to be able to check it with Pro_develop?

Re: ProDimensionCanRegen in Creo3

Presuming you want to skip the feature dims, and that you'd want to skip driven dimensionsmade in an entirely different drawing which cannot be shown in your target drawing, you can skip that and just use ProDimensionCanRegenerate(p_dim, p_draw, &can_regen) 's return value (both will give PRO_TK_BAD_CONTEXT).

To the license issue... though it seems strange for a dimension in 2d to be requiring this, I don't think I can address whether a license requirement for a Toolkit API that replaced a Pro/DEVELOP API is justified in a forum discussion.  Please file an SPR, saying that you could do this with the Pro/DEVELOP function and basic TK license, and you hope/expect to be able to do the same action in the new release without an additional license, and I'll refer it to the right person.

View solution in original post

Re: ProDimensionCanRegen in Creo3

Thanks for your help Matthew.    Yes there is a licensing issue with ProDimensionIsDriving command, its not included in the standard toolkit license.  and I'll look into a separate spr for that.  Whenever I would include the function in my programs would say it was not unlocked, even though I currently held the toolkit license.    And by the way the toolkit documention that is online (support.ptc.com/cs/tkdoc/Creo3/protoolkit/...)  does not include ProdimensionCanRegenerate function yet, but if you use the tkdoc from your install location in m110 it is included in that set.

  Either way I got around the issue as you suggested, that if ProDimensionCanRegenerate returns anything other than protk_no_error the dimension is not driven.  Its a backdoor way at coming to that conclusion, but gets me by for now.  Thanks!

Re: ProDimensionCanRegen in Creo3

Mark Steffke wrote:

I'd say my dimension is driven.    I created a circular cut feature in the existing model.   Then I went into the drawing and created a dimension that measured from the edge of the part to the center of the circle cut.    I then  suppressed the circle cut, came back into the drawing and that dimension was magenta.  its id is #ad127.    But is that the same as Rel_driven?   There's really no relation controlling that.   Rel_driven seems to be the only thing that can be checked.

Mark,

If you are chasing drawing  dimensions with missing references you probably should use ProDimensionAttachmentsGet(...), following up with ProSelectionVerify(...) and ProRefStatusGet(...) for resulting members of ProDimAttachment array.

HIH.

Feliks.

Announcements