Quantcast
Channel: NX Journaling - Journaling / NXOpen API
Viewing all articles
Browse latest Browse all 787

Move PMI object to a new Layer

$
0
0

I'm working in team center if this matters.

So I was reading this comment http://nxjournaling.com/comment/5469#comment-5469 and tried to implement it to move my PMI to new layers but I am clearly failing. I have been trying to figure out how to read the NX Open helpfile but its really difficult for me to navigate.

https://docs.plm.automation.siemens.com/data_services/resources/nx/1899/...

Ultimately what I would like this code to do is to find all PMI items in the current work part and then move the first item to layer 20, the second item to layer 21, the third to 22 and so on.

Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
 
Module MoveTextToLayer
    Sub Main()
        Dim theSession As Session = Session.GetSession()
        Dim workPart As Part = theSession.Parts.Work
        Dim lw As ListingWindow = theSession.ListingWindow
        Dim Layno As Integer
	Dim displayModification1 As DisplayModification
        Layno = 20
        Dim textObjs As New List(Of DisplayableObject)
 
        For Each temp As Features.Feature In theSession.Parts.Work.Features
            If TypeOf (temp) Is Annotations.IPmi Then
                Dim myPMI As Annotations.IPmi = temp
                textObjs.Add(myPMI)
		displayModification1 = theSession.DisplayManager.NewDisplayModification()
		displayModification1.NewLayer = Layno
		displayModification1.Apply(textObjs.ToArray)
		Layno = Layno + 1
		Dim textObjs As New List(Of DisplayableObject)
	    else
		lw.writeline("Item is not of type PMI")
		lw.writeline("---------------------------------------------")
            End If
        Next
 
        displayModification1.Dispose()
 
    End Sub
 
End Module
<code>

Viewing all articles
Browse latest Browse all 787

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>