Community
PowerMill Forum
Welcome to Autodesk’s PowerMill Forums. Share your knowledge, ask questions, and explore popular PowerMill topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
iroda
289 Views, 6 Replies

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

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. 

6 REPLIES 6
Message 2 of 7
dsmits
in reply to: iroda

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>

Message 3 of 7
dsmits
in reply to: iroda

there is an event for 


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

Message 4 of 7
iroda
in reply to: dsmits

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 

Message 5 of 7
iroda
in reply to: dsmits

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...

Message 6 of 7
dsmits
in reply to: iroda

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

 

Message 7 of 7
iroda
in reply to: dsmits

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report