Hello !
in VB Journaling, is it possible to create an '' expression '' in a component from an assembly?
The selection mode is the tag of the part or the name of the part in my assembly.
I found in your examples and on Gtac that to create an expression, the part must be workpart.
In fact, how to associate a part tag or its name with an active workpart or make a work part from a tag or a name of part in the assembly?
In fact, from an assembly, i want to copy the value of an expression to the value of the same expresssion but in another part in an assembly.
Example:
I want to copy the Lenght value of part "A" to the "Lenght" value of part "B". Everything must be done from an assembly. Now, in my code, I am able to have the Tag or the name of each of the two parts.
Best Regards!
-------------------------------------------------------------------
Try
Selection.SelectionScope.AnyInAssembly
'Dim SelectionMask(0) As Selection.MaskTriple
With SelectionMask(0)
.Type = UFConstants.UF_component_type
.Subtype = UFConstants.UF_all_subtype '0
.SolidBodySubtype = 0
End With
selection0.SetSelectionFilter(Selection.SelectionAction.ClearAndEnableSpecific, SelectionMask)
selection01.SetSelectionFilter(Selection.SelectionAction.ClearAndEnableSpecific, SelectionMask)
Catch ex As Exception
'---- Enter your exception handling code here -----
theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString)
End Try
part "A" = sel_obj_source As NXObject
part "B" = sel_obj_cible As NXObject
'------------------------------------------------------------------------------
'Fonction de rappel: update_cb
'------------------------------------------------------------------------------
Public Function update_cb(ByVal block As NXOpen.BlockStyler.UIBlock) As Integer
Dim s As Session = Session.GetSession()
Dim ufs As NXOpen.UF.UFSession = NXOpen.UF.UFSession.GetUFSession()
Dim sel_obj_source As NXObject
Dim sel_obj_cible As NXObject
Dim subtype As Integer
Dim theUI As UI = ui.GetUI
Dim numsel As Integer = theUI.SelectionManager.GetNumSelectedObjects()
Dim c_part As Part = Nothing
Try
If block Is selection0 Then
'----------------------------------------
'Active les boutons OK/APPLY
ActifSelection0 = 0
StatusProgressionSource (sel_obj_source)
Echo("Retour Source")
'----------------------------------------
'Si action sur la sélection01 (Composante cible)
ElseIf block Is selection01 Then
'----------------------------------------
'Active les boutons OK/APPLY
ActifSelection01 = 0
StatusProgressionCible (sel_obj_source, sel_obj_cible)
Echo("Retour Cible")
'Si action sur le bouton0 (Réinitialisation)
ElseIf block Is button0 Then
Dim blockSelPL1 As PropertyList = selection0.GetProperties()
Dim emptyArray1(-1) As TaggedObject
Dim blockSelPL2 As PropertyList = selection01.GetProperties()
Dim emptyArray2(-1) As TaggedObject
blockSelPL1.SetTaggedObjectVector("SelectedObjects", emptyArray1)
ActifSelection0 = 0
blockSelPL2.SetTaggedObjectVector("SelectedObjects", emptyArray2)
ActifSelection01 = 0
'Focus sur "Selection0" après la réénitialisation
selection0.focus()
ufs.Ui.CloseListingWindow()
Echo("Réinitialisation...")
'---- Enter your code here -----
'Si action sur le bouton0 (Réinitialisation)
ElseIf block Is button01 Then
'---- Enter your code here -----
'Si action sur le toggle (Afficher la fenetre d'information)
ElseIf block Is toggle0 Then
'---- Enter your code here -----
Try
If Toggle0.value = False then
'Toggle0.value = True
IgnoreEcho = True
Echo("Case décoché.")
ufs.Ui.CloseListingWindow()
Else If Toggle0.value = True Then
'Toggle0.value = False
IgnoreEcho = False
Echo("Case coché.")
Echo("_______________________________________________________________")
Echo("Heure de fin: " & CType(TimeOfDay(), String))
Echo("Nombre de pièce traité: ")
Echo("Fin du rapport")
End If
Catch ex As Exception
'---- Enter your exception handling code here -----
theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString)
End Try
'Bouton INVISIBLE, mais actif !!!
ElseIf block Is button01 Then
'---- Enter your code here -----
'Toggle INVISIBLE, mais actif !!!!
ElseIf block Is toggle01 Then
'---- Enter your code here -----
End If
Catch ex As Exception
'---- Enter your exception handling code here -----
theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString)
End Try
Try
If ActifSelection0 = 0 and ActifSelection01 = 0 then
ufs.Ui.CloseListingWindow()
ECHO("Programme pour dupliquer les dimenssions d'une planche vers une autre.")
ECHO("Heure de depart: " & CType(TimeOfDay(), String))
ECHO("_______________________________________________________________")
Echo("0-0")
Echo("Dupplication impossible !")
Echo("Composante source et cible manquante.")
Echo("")
Echo("Nombre de selection pour la composante source: 0")
Echo(" Chemin: Vide")
Echo(" Nom fichier: Vide")
Echo(" Tag: Vide")
Echo(" Type: Vide")
Echo(" Subtype: Vide")
Echo(" Objet de type: Vide")
Echo("")
Echo("Nombre de selection pour la composante cible: 0")
Echo(" Chemin: Vide")
Echo(" Nom fichier: Vide")
Echo(" Tag: Vide")
Echo(" Type: Vide")
Echo(" Subtype: Vide")
Echo(" Objet de type: Vide")
Echo("")
Echo("Veuillez sélectionner une composante source et cible de type planche.")
Else If ActifSelection0 = 0 and ActifSelection01 = 1 then
ufs.Ui.CloseListingWindow()
ECHO("Programme pour dupliquer les dimenssions d'une planche vers une autre.")
ECHO("Heure de depart: " & CType(TimeOfDay(), String))
ECHO("_______________________________________________________________")
Echo("0-1")
Echo("Dupplication impossible !")
Echo("Composante source manquante.")
Echo("")
Echo("Nombre de selection pour la composante cible: 0")
Echo(" Chemin: Vide")
Echo(" Nom fichier: Vide")
Echo(" Tag: Vide")
Echo(" Type: Vide")
Echo(" Subtype: Vide")
Echo(" Objet de type: Vide")
Echo("")
Echo("Nombre de selection pour la composante cible: " & CibleValObjet)
Echo(" Chemin: " & CibleValChemin)
Echo(" Nom fichier: " & CibleValNom)
Echo(" Tag: " & CibleValTag)
Echo(" Type: " & CibleValType)
Echo(" Subtype: " & CibleValSubtype)
Echo(" Objet de type: " & CibleValObjetType)
If LireAttribueCibleStatus = 1 Then
Echo(" UM_STD_DIM: " & ValAttCible_UM_STD_DIM)
Echo(" UM_STD_SCALE_LAB: " & ValAttCible_UM_STD_SCALE_LAB)
Echo(" UM_STD_SCALE_DIM: " & ValAttCible_UM_STD_SCALE_DIM)
End If
Echo("")
Echo("Veuillez sélectionner une composante source de type planche.")
Else If ActifSelection0 = 1 and ActifSelection01 = 0 then
ufs.Ui.CloseListingWindow()
ECHO("Programme pour dupliquer les dimenssions d'une planche vers une autre.")
ECHO("Heure de depart: " & CType(TimeOfDay(), String))
ECHO("_______________________________________________________________")
Echo("1-0")
Echo("Dupplication impossible !")
Echo("Composante cible manquante.")
Echo("")
Echo("Nombre de selection pour la composante source: " & SourceValObjet)
Echo(" Chemin: " & SourceValChemin)
Echo(" Nom fichier: " & SourceValNom)
Echo(" Tag: " & SourceValTag)
Echo(" Type: " & SourceValType)
Echo(" Subtype: " & SourceValSubtype)
Echo(" Objet de type: " & SourceValObjetType)
If LireAttribueSourceStatus = 1 Then
Echo(" UM_STD_DIM: " & ValAttSource_UM_STD_DIM)
Echo(" UM_STD_SCALE_LAB: " & ValAttSource_UM_STD_SCALE_LAB)
Echo(" UM_STD_SCALE_DIM: " & ValAttSource_UM_STD_SCALE_DIM)
End If
Echo("")
Echo("Nombre de selection pour la composante cible: 0")
Echo(" Chemin: Vide")
Echo(" Nom fichier: Vide")
Echo(" Tag: Vide")
Echo(" Type: Vide")
Echo(" Subtype: Vide")
Echo(" Objet de type: Vide")
Echo("")
Echo("Veuillez sélectionner une composante cible de type planche.")
Else If ActifSelection0 = 1 and ActifSelection01 = 1 then
ufs.Ui.CloseListingWindow()
ECHO("Programme pour dupliquer les dimenssions d'une planche vers une autre.")
ECHO("Heure de depart: " & CType(TimeOfDay(), String))
ECHO("_______________________________________________________________")
If ActifSelection0 = 1 and ActifSelection01 = 1 and LireAttribueSourceStatus = 1 then
Echo("1-1-1_Duplication")
Else If ActifSelection0 = 1 and ActifSelection01 = 1 Then
Echo("1-1")
End If
Echo("")
Echo("Nombre de selection pour la composante source: " & SourceValObjet)
Echo(" Chemin: " & SourceValChemin)
Echo(" Nom fichier: " & SourceValNom)
Echo(" Tag: " & SourceValTag)
Echo(" Type: " & SourceValType)
Echo(" Subtype: " & SourceValSubtype)
Echo(" Objet de type: " & SourceValObjetType)
If LireAttribueSourceStatus = 1 Then
Echo(" UM_STD_DIM: " & ValAttSource_UM_STD_DIM)
Echo(" UM_STD_SCALE_LAB: " & ValAttSource_UM_STD_SCALE_LAB)
Echo(" UM_STD_SCALE_DIM: " & ValAttSource_UM_STD_SCALE_DIM)
End If
Echo("")
Echo("Nombre de selection pour la composante cible: " & CibleValObjet)
Echo(" Chemin: " & CibleValChemin)
Echo(" Nom fichier: " & CibleValNom)
Echo(" Tag: " & CibleValTag)
Echo(" Type: " & CibleValType)
Echo(" Subtype: " & CibleValSubtype)
Echo(" Objet de type: " & CibleValObjetType)
If LireAttribueCibleStatus = 1 Then
Echo(" UM_STD_DIM: " & ValAttCible_UM_STD_DIM)
Echo(" UM_STD_SCALE_LAB: " & ValAttCible_UM_STD_SCALE_LAB)
Echo(" UM_STD_SCALE_DIM: " & ValAttCible_UM_STD_SCALE_DIM)
End If
Echo("")
Echo("Dupplication possible de " & theCompSource.Name & " vers " & theCompCible.Name & ".")
ManipulationDesChaines(ValAttSource_UM_STD_SCALE_DIM,ValAttSource_UM_STD_SCALE_LAB,ValAttSource_UM_STD_OPT_LAB,ValAttSource_UM_STD_OPT_DIM)
End If
Catch ex As Exception
'---- Enter your exception handling code here -----
theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString)
End Try
update_cb = 0
End Function