cancel
Showing results for 
Search instead for 
Did you mean: 
Security Alert Log4j Security Vulnerability. Click here to know more.
cancel
Showing results for 
Search instead for 
Did you mean: 

Assembly Component with Offset

WebOfMadness
1-Newbie

Assembly Component with Offset

Hello planetPTC,

I was hoping someone could point me in the right direction. I'm able to assembly a component using CSYS reference, but I'm unsure how to include a XYZ offset from the AssemblyReference. Is this possible?. Or do I need to create a new CSYS, and if so how do I do that too...

 

Regards,

 

WOM

6 REPLIES 6

Hi,

Csys constraint has not offset values as far as I know. It just aligns 2 coord systems. But you can create the csys with JLink using a UDF. First create a csys with offsets in normal Pro/E mode, create a UDF out of this feature, and then use JLink to place te udf. Then you can assemble the component to this newly created csys.

Does that answer your question ?

Regards,

Tom

Thank You Tom,

Do you believe it is possible to dynamically create a UDF as required that contains a CSYS with the required XYZ offsets, or would it be better to create a new CSYS from the default CSYS with the required XYZ offset. From there I would constraint to the new CSYS.

I've tried creating a new CSYS with Runmacro from a mapkey routine, but I'm hoping there's a cleaner method.

Regards,

WOM

JLink does not have a lot of API methods to create features like in Pro/Toolkit, but what I am saying is that it does contain methods to create features via UDFs programmatically. You only have to create the UDF once in Pro/ENGINEER, defining the dimension prompts etc. Then you can create this UDF with programmatic input from your JLink app.

Use the following JLink method:

  • pfcSolid.Solid.CreateUDFGroup

This method returns a feature group from which you can select the csys to be used as reference for assembling the component.


    Can you get it work with this ?


    Regards,


      Tom

      Thank you Tom,

      I will try using a UDF.

      Regards,

      WOM.

      Tom,

      I've done some reading and I'm unsure how I can implement a UDF in an assembly model. My hope was to add a new CSYS in an existing assembly, which I then could assembly in a new part or assembly to the new CSYS with variable xyz offsets. The end result would be a new assembly with all models constrained to a CSYS.

      I've tried using the MATE_OFF constraint as mention, but the offset value is not valid with a CSYS constraint type.

      Are you aware of a sample protoolkit code or dll I could reference to insert new CSYS into an assembly model?

      Regards,

      WOM

      Hello

      To assemble a component into an assembly by using an offset,you need to first setup an identity matrix and get the component paths of the assembly then select the references by name and type. Then allocate the constraint type (ComponentConstraintType.ASM_CONSTRAINT_MATE_OFF). After defining the constraint type then you can set the offset (constr.SetOffset(Double)), set the assembly and component references, and set the constraints. A example is shown below and review the pfcComponentFeatExamples.java example file found at the <ProeWildfire Loadpoint>\jlink\jlink_appls\jlinkexamples\ folder. This is a nice example of how to assemble a component. Hope this helps.

      ComponentPath path = pfcAssembly.CreateComponentPath(assembly, ids);

      /*-----------------------------------------------------------------*\
      Allocate the references
      \*-----------------------------------------------------------------*/
      Selection asmSel = pfcSelect.CreateModelItemSelection(asmItem, path);
      Selection compSel = pfcSelect.CreateModelItemSelection(compItem,null);

      /*-----------------------------------------------------------------*\
      Allocate and fill the constraint.
      \*-----------------------------------------------------------------*/
      ComponentConstraint constr = pfcComponentFeat.ComponentConstraint_Create(ComponentConstraintType.ASM_CONSTRAINT_MATE_OFF);

      constr.SetOffset(5.0);

      constr.SetAssemblyReference(asmSel);
      constr.SetComponentReference(compSel);

      constrs.insert(constrs.getarraysize(), constr);

      /*-----------------------------------------------------------------*\
      Set the assembly component constraints and regenerate the assembly.
      \*-----------------------------------------------------------------*/
      asmcomp.SetConstraints(constrs, null);

      assembly.Regenerate(null);

      J.D. Felkins, FELCO Solutions Inc, jfelkins@felcosolutions.com, www.felcosolutions.com

      Announcements