Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

User exit on File Open or File NEw

Status
Not open for further replies.

PSI-CAD

Computer
Feb 13, 2009
997
Hi

I succeed to create a user exit for file open and file new, and put a code to import a catalogue for attribut

It works but I encountered the problem that it doesn't work if I have no part in my session

Because, I need to define the workpart and the displayed part

Is there any setting to get the creation of the file before my code execution ?

[pre] Function ufcre() As Integer


Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
Dim workPart As NXOpen.Part = theSession.Parts.Work
Dim displayPart As NXOpen.Part = theSession.Parts.Display

' ----------------------------------------------
' Importation du catalogue concepteur
' ----------------------------------------------

Dim attributeTemplatesBuilder1 As NXOpen.AttributeTemplatesBuilder = workPart.PropertiesManager.CreateAttributeTemplatesBuilder()
attributeTemplatesBuilder1.Templates = NXOpen.AttributeTemplatesBuilder.TemplatesOptions.Catalog
attributeTemplatesBuilder1.CatalogFilename = c:\temp\catalogue_CONCEPTEURS.xml"
attributeTemplatesBuilder1.ImportCatalog()

' ----------------------------------------------
' Importation du catalogue désignation
' ----------------------------------------------

attributeTemplatesBuilder1.CatalogFilename = JANUS_ADD_PLAQUE_MENU_TEMPLATE_DIR + "\catalogue_designation.xml"
attributeTemplatesBuilder1.ImportCatalog()

attributeTemplatesBuilder1.Destroy()

End Function

[/pre]

Thanks in advance


Regards
Didier Psaltopoulos
 
Replies continue below

Recommended for you

Hi,

I found the solution

we need a RETURN 2 at this location

[pre] Function ufcre() As Integer

Return 2

Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
Dim workPart As NXOpen.Part = theSession.Parts.Work
Dim displayPart As NXOpen.Part = theSession.Parts.Display[/pre]


Regards
Didier Psaltopoulos
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor