Showing results for 
Search instead for 
Did you mean: 

PMI annotations I create in NXOpen crash NX if Settings are looked at


I'm working on a Python tool with NXOpen to manage embedded PMI notes, and I've run into a repeatable crash issue.  Whenever I look at the Settings (double click then click Settings icon) of a PMI Annotation I created using the script, it crashes NX.  Error message is "Unhandled operating system exception: e06d7363"  So far I have only worked on creating PartIdentification typed notes - I don't want to move forward to the other types until I can resolve these crashes.

First dialog box that pops up:

Fatal error 1 170918.pngFatal error ... e06d7363

Second dialog box that pops up:

Initialization - COLLAPSE 2 170918.pngInitialization - COLLAPSE

That dialog box is really confusing because my D drive is my DVD reader (which is broken, but that shouldn't matter to NX).  So that filepath goes nowhere.

This crash/error does not appear when I look at the Settings on PartIdentification objects that already exist.

This crash/error does not appear when I look at the Settings on PartIdentification objects that I create manually through the normal ribbon interface.

I assume my script is missing something that is important to the health of the PartIdentification object - does anyone have any ideas?  It doesn't crash when the object is created, just when it is queried later after I've closed out of the dialog box.


Re: PMI annotations I create in NXOpen crash NX if Settings are looked at

Gears Honored Contributor Gears Honored Contributor
Gears Honored Contributor

Can you post the relevant code?

I assume that you are using a PMI note builder object; do you validate the input before committing and do you destroy the builder object after the note is created?

Re: PMI annotations I create in NXOpen crash NX if Settings are looked at

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

Note (I think) the "D:\..." path is where the source file was located when the developer compiled/linked their code.  It has nothing to do with your PC.



Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP16/TC11.2
I'd rather be e-steamed than e-diseaseled

Re: PMI annotations I create in NXOpen crash NX if Settings are looked at


Some relevant code is below, I've removed sensitive portions and replaced with #....  There are a lot of lines here that I copied from recorded Journals to attempt to stop the crashing.  I do not validate the builder before committing, but I do make sure to destroy it when I'm done.  Often in this code I am making a builder just to extract information, and I don't commit it, but I do destroy it.

def formatThisBuilder(self, thisTitle, thisBuilder):
    noteSpecificFormatting = self.ctrlNoteProps[thisTitle]
    campusSpecificFormatting = self.campusDefaults[self.mySetCampus]
    thisBuilder.Origin.Plane.PlaneMethod = NXOpen.Annotations\
    ### This section contain settings that aren't used but that
    ### seem to prevent crashes from happening if the PMI note
    ### is asked for its properties later
    leaderData1 = self.theWorkPart.Annotations.CreateLeaderData()    
    leaderData1.StubSize = 0.25    
    leaderData1.Arrowhead = NXOpen.Annotations.LeaderData.ArrowheadType.FilledArrow    
    leaderData1.VerticalAttachment = NXOpen.Annotations.LeaderVerticalAttachment.Center    
    leaderData1.StubSide = NXOpen.Annotations.LeaderSide.Inferred

    assocOrigin1 = NXOpen.Annotations.Annotation.AssociativeOriginData()    
    assocOrigin1.OriginType = NXOpen.Annotations.AssociativeOriginType.Drag
    assocOrigin1.View = NXOpen.View.Null
    assocOrigin1.ViewOfGeometry = NXOpen.View.Null
    assocOrigin1.PointOnGeometry = NXOpen.Point.Null
    assocOrigin1.VertAnnotation = NXOpen.Annotations.Annotation.Null
    assocOrigin1.VertAlignmentPosition = NXOpen.Annotations.AlignmentPosition.TopLeft
    assocOrigin1.HorizAnnotation = NXOpen.Annotations.Annotation.Null
    assocOrigin1.HorizAlignmentPosition = NXOpen.Annotations.AlignmentPosition.TopLeft
    assocOrigin1.AlignedAnnotation = NXOpen.Annotations.Annotation.Null
    assocOrigin1.DimensionLine = 0
    assocOrigin1.AssociatedView = NXOpen.View.Null
    assocOrigin1.AssociatedPoint = NXOpen.Point.Null
    assocOrigin1.OffsetAnnotation = NXOpen.Annotations.Annotation.Null
    assocOrigin1.OffsetAlignmentPosition = NXOpen.Annotations.AlignmentPosition.TopLeft
    assocOrigin1.XOffsetFactor = 0.0
    assocOrigin1.YOffsetFactor = 0.0
    assocOrigin1.StackAlignmentPosition = NXOpen.Annotations.StackAlignmentPosition.Above
    ### End of section of ignorable settings
    thisBuilder.Style.LetteringStyle.GeneralTextSize = round(
            float(campusSpecificFormatting['textHeightPMI']) * \
            float(noteSpecificFormatting['FontScale']), 3)   
    thisBuilder.Style.LetteringStyle.GeneralTextFont = self.fontNumber
    chosenWidth = self.textColorFontWidthNewEmbeddedPMI.WidthValueAsString
    if chosenWidth == 'Thin Width':
        thisBuilder.Style.LetteringStyle.GeneralTextLineWidth = \
    elif chosenWidth == 'Thick Width':
        thisBuilder.Style.LetteringStyle.GeneralTextLineWidth = \
    else: #'Normal Width'
        thisBuilder.Style.LetteringStyle.GeneralTextLineWidth = \
    thisBuilder.Style.LetteringStyle.GeneralTextColor = \
    self.logInfoList.append('g ')
    thisBuilder.Origin.Anchor = eval(noteSpecificFormatting['Anchor'])
    self.logInfoList.append('h ')
    ### This section is entirely to figure out where to place
    # the origin of the note in model space
        mX = round(mX, 3)
        mY = round(mY, 3)
        mZ = round(mZ, 3)

        thisOrigin = NXOpen.Point3d(mX, mY, mZ)
                NXOpen.TaggedObject.Null, NXOpen.View.Null, thisOrigin)
    self.logInfoList.append('j ')
    ### End of section to place origin of note object
        body1 = self.selectAssociatedPartsBodies.GetSelectedObjects()[0]
        added1 = thisBuilder.AssociatedObjects.Nxobjects.Add(body1)

def invokePartIDBuilder(self):
    if 'PartID' in self.PMIDefined:
        onePMIAttributeObject = NXOpen.TaggedObjectManager\
        partIDBuilder1 = self.theWorkPart.PmiManager.PmiAttributes\
        self.PMIDefined['PartID'] = {}
        partIDBuilder1 = self.theWorkPart.PmiManager.PmiAttributes\
    partIDBuilder1 = formatThisBuilder(self, 'PartID',
            elif block == self.stringIDPartNo:
                partIDBuilder1 = invokePartIDBuilder(self)
                newIDString = self.stringIDPartNo.Value
                partIDBuilder1.PartIdentifier = newIDString                
                self.PMIDefined['PartID']['newID'] = \
                nXObject1 = partIDBuilder1.Commit()
                self.PMIDefined['PartID']['exTag'] = nXObject1.Tag

Re: PMI annotations I create in NXOpen crash NX if Settings are looked at


(Deleting duplicate post, trying not to destroy anyone elses' replies to this post...)

Re: PMI annotations I create in NXOpen crash NX if Settings are looked at


I've added a step to validate the builder before committing it.  It passes, and then it still crashes when I try to view the Settings for the Part Identification note created.

except Exception as ex:
    self.theUI.NXMessageBox.Show("partIDBuilder1 Validation",
nXObject1 = partIDBuilder1.Commit()

I also confirmed that using a right click to go into Settings also causes the same exact crash.


Re: PMI annotations I create in NXOpen crash NX if Settings are looked at


I got it to stop crashing!  These are the lines I added to or changed in the formatThisBuilder function between when it wasn't working and when it was working:

thisBuilder.Style.LetteringStyle.GeneralTextAspectRatio = 1.0
thisBuilder.Style.LetteringStyle.GeneralTextCharSpaceFactor = 1.0
thisBuilder.Style.LetteringStyle.GeneralTextLineSpaceFactor = 1.0
chosenColorNumber = self.textColorFontWidthNewEmbeddedPMI.GetColorValue()[0]
colorObject = self.theWorkPart.Colors.Find(chosenColorNumber)
thisBuilder.Style.LetteringStyle.GeneralTextColor = colorObject

I suspect there was something wrong (upsetting to NX) with the one-line color value assignment I was trying to do before.  So I copied a "clunky" block of code from another script that I know works, and that works here, too. 

Earlier, I added this line as a catch-all, but it wasn't enough to stop the crashing:


So that made me suspicious of the things I was setting, rather than things I was missing. 

Lesson learned: stop trying to optimize everything, sometimes NX likes having things on separate lines.