Submitted by GervaldNik on Tue, 03/15/2016 - 11:07
Forums:
And one more my problem..
It should automatically wave freeze persistently the displayed part.
Is there any hope?
And one more my problem..
It should automatically wave freeze persistently the displayed part.
Is there any hope?
re: wave freeze
Could you add some details to this question?
As it is currently written, I have no idea what you are trying to do.
I meant it:
I meant it:
First way:
Assemblies->WAVE->Associativity Manager->Edit Frozen Status-> =select part name= -> Session freeze->persistently freeze.
Second method:
Right clik on header "Descriptive part name" in Assembly Navigator -> WAVE mode turn on. Then right clik on part name->WAVE->freeze persistently.
It is possible to make a macro, but macro writes the name of the workpart, and does not work with other parts.
re: freeze links
Thanks, I better understand what you want to do now.
Unfortunately, I don't have a wave license (required to freeze links). But there is a .Freeze and .FreezePersistently method that may be of use to you. Like I said, I don't have a wave license, so I cannot generate any example code for you.
Thank you, methods gives hope
Thank you, methods gives hope. Give me a couple of tips, please? I read "Strategy for searching the help file" and NetApiReference.In manual i did find this:
public void FreezePersistently(
int n_parts,
Tag[] parts
)
int n_parts Input Number of parts to freeze persistently.
tag_t * parts Input Array of tags of parts to freeze persistently
if I am right, the code should contain this
Dim ufs As UFSession = UFSession.GetUFSession()
Dim n_parts As Integer
UFS.WAVE.freezepersistently (X, Y)
but, i dont know, what must i do with X and Y
possible tag specifies a Displayble Part, or WorkPart?
re: freeze parts
The "n_parts" input is the number of parts that you want to freeze; the "tag()" array is the array of part tags of the parts that you want to freeze. The part tags can reference any part that you currently have open in the NX session (I suggest making sure the parts are opened fully before performing wave operations on them).
One way to call the function would be to create an array of the part tags that you want to freeze, then pass in the {array}.Length property (this is an integer telling us how many items are in the array) and the array of tags itself.
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Module Module57
Sub Main()
Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession
Dim freezePartTags(2) As Tag
freezePartTags(0) = part0.tag
freezePartTags(1) = part1.tag
freezePartTags(2) = part2.tag
theUfSession.Wave.FreezePersistently(freezePartTags.Length, freezePartTags)
End Sub
End Module
Note that in the code above, the array of parts to use is hardcoded into the journal. If/when you wanted to freeze other parts, you would need to change the source code of the journal - not really convenient. Better would be to use a dynamic array and use the "ReDim Preserve" keywords to add new items into the array.
Better still would be to use a List object. A list object is similar to a dynamic array, but it will resize itself making the code easier to write and maintain.
Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpen.UF
Module Module57
Sub Main()
Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession
Dim listFreezeTags As New List(Of Tag)
For i As Integer = 0 To 9
'get a part reference and add the tag to the list object
listFreezeTags.Add(somePart(i).Tag)
Next
theUfSession.Wave.FreezePersistently(listFreezeTags.Count, listFreezeTags.ToArray)
End Sub
End Module
In the case above, the {list}.Count property will return an integer telling us how many items are in the list (similar to the {array}.Length property); and the {list}.ToArray method will return an array of objects. The .ToArray method is very handy when working with the NXOpen API as it often requires an array of objects passed to a particular function; the {list}.ToArray method allows us to use a list to gather the objects then easily convert the list to the required array for the function.
Victory!
Many thanks for the detailed response!!!
In fact, my problem is more narrow, I need to freeze only the workpart.
I do not understand how to work with tags, but intuitively I got the desired result in this code:
Dim freezePartTags (0) As Tag
freezePartTags (0) = workpart.tag
UFS.WAVE.freezepersistently (freezePartTags.Length, freezePartTags)
Maybe someone will come in handy =)