PowerMill API - 'EntityCreated' event not fired if NC program item created

PowerMill API - 'EntityCreated' event not fired if NC program item created

iroda
Participant Participant
628 Views
6 Replies
Message 1 of 7

PowerMill API - 'EntityCreated' event not fired if NC program item created

iroda
Participant
Participant

Hi All,

 

Anyone faced the issue that PowerMill's event manager doesn't fire 'EntityCreated' event if an NC program item created?

I've subscribed to 'EntityCreated' event, and the event fired for all types of PowerMill entities (toolpaths, patterns, etc.) but NC program items. Any idea?

 

Thx. 

0 Likes
Accepted solutions (1)
629 Views
6 Replies
Replies (6)
Message 2 of 7

dsmits
Advocate
Advocate

if i had to guess its only for these
print = to_xml(valid_entity_types())


Process Command : [print = to_xml(valid_entity_types())\r]

<array>
<string>MachineTool</string>
<string>NCProgram</string>
<string>Setup</string>
<string>Toolpath</string>
<string>Tool</string>
<string>Boundary</string>
<string>Pattern</string>
<string>FeatureGroup</string>
<string>Featureset</string>
<string>Workplane</string>
<string>Level</string>
<string>Model</string>
<string>StockModel</string>
<string>Group</string>
<string>Macro</string>
<string>Process</string>
<string>DrillingHole</string>
</array>

0 Likes
Message 3 of 7

dsmits
Advocate
Advocate

there is an event for 


<NCProgramItemAdded event_group="NCProgram">
<InsertedItemName/>
<InsertedItemType/>
<Name/>
</NCProgramItemAdded>
<NCProgramItemRemoved event_group="NCProgram">
<Name/>
<RemovedItemName/>
<RemovedItemType/>
</NCProgramItemRemoved>

0 Likes
Message 4 of 7

iroda
Participant
Participant

The list seems to me correct. Although, I don't really understand how does your post answer my question...

 

Anyway, in this example (line 111) on GitHub the NC program entity type is called 'Ncprogram' (note the lowercase characters) instead of 'NCProgram' as in your array: powermill-api-examples 

0 Likes
Message 5 of 7

iroda
Participant
Participant

Yeah, I'm aware of those NCProgram related events. However, these events fired only if I add/remove a toolpath to/from an NC program - which suggest that the API has a different interpretation of an 'NC program item' as myself. In my interpretation an NC program item is the NC program itself, and not its toolpath child elements...

0 Likes
Message 6 of 7

dsmits
Advocate
Advocate

mmm not sure
i use powermill plugin and works. i dont use the api

        Public Sub ProcessEvent(ByVal EventData As String) Implements PowerMILL.IPowerMILLPlugin.ProcessEvent
            Try
                Dim xe As XElement = XElement.Parse(EventData)
                If xe Is Nothing Then Exit Sub
                If xe.Name.LocalName.Equals("EntityCreated") Then
                    MsgBox(EventData.ToString)
                End If
            Catch ex As Exception
            End Try
        End Sub

 

dsmits_0-1718987723090.png

 

0 Likes
Message 7 of 7

iroda
Participant
Participant
Accepted solution

My bad. I've found the problem. It is very recommended not to declare a list only, but also initialize it... and not in a deep function somewhere in a code which you think is executed, but actually executed too.

 

BTW, you are using the API, if your plugin works. The plugin is using it 🙂

 

Thx. for the help and your time.

0 Likes