Forum FlexPro – Discuss your topic!

Liste déroulante avec objet différent en VBA

Accueil > Community > Automation and VBA > Liste déroulante avec objet différent en VBA

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #12390
    Bertrand SIMONBertrand SIMON
    Participant

    Bonjour,
    j’utilise un logiciel de traitement du signal “FLEXPRO” me permettant de dépouiller des enregistrements numériques. Les enregistrements sont réalisés par un enregistreur numérique pouvant enregistrer 16 voies. Le nom des voies de l’enregistreur sont toutes différentes et change à chaque enregistrement. Lorsque Flexpro collecte l’enregistrement, il conserve le nom des voies (pour faciliter le traitement).

    Voila mon (1er) problème:
    Je souhaiterai créer dans un UserForm, une liste déroulante qui reprendrait les noms des voies que nous enregistrons. De cette liste, l’utilisateur pourra sélectionner un noms d’une voie pour réaliser différents calculs par la suite (valeur moyenne entre curseur, valeur max, etc..).

    Je vous remercie par avance de vos réponse
    Merci d’avance

    Le même mais traduit en Anglais par GOOGLE:

    Good morning,
    I use a software signal processing “FLEXPRO” to deprive me of digital recordings. The recordings were made by a digital recorder that can record 16 channels. The name of the recorder tracks are all different and changing each registration. When Flexpro collection registration, he retains the title track (to facilitate the treatment).

    This is my (1st) problem:
    I would like to create in a UserForm, a list that would take over the names of avenues that we record. From this list, the user can select a name from one track to achieve various calculations thereafter (average value between cursor, max value, etc. ..).

    Thank you in advance for your reply
    Thanks in advance

    #8073
    Bertrand SIMONBertrand SIMON
    Participant

    Bonjour,
    j’utilise un logiciel de traitement du signal “FLEXPRO” me permettant de dépouiller des enregistrements numériques. Les enregistrements sont réalisés par un enregistreur numérique pouvant enregistrer 16 voies. Le nom des voies de l’enregistreur sont toutes différentes et change à chaque enregistrement. Lorsque Flexpro collecte l’enregistrement, il conserve le nom des voies (pour faciliter le traitement).

    Voila mon (1er) problème:
    Je souhaiterai créer dans un UserForm, une liste déroulante qui reprendrait les noms des voies que nous enregistrons. De cette liste, l’utilisateur pourra sélectionner un noms d’une voie pour réaliser différents calculs par la suite (valeur moyenne entre curseur, valeur max, etc..).

    Je vous remercie par avance de vos réponse
    Merci d’avance

    Le même mais traduit en Anglais par GOOGLE:

    Good morning,
    I use a software signal processing “FLEXPRO” to deprive me of digital recordings. The recordings were made by a digital recorder that can record 16 channels. The name of the recorder tracks are all different and changing each registration. When Flexpro collection registration, he retains the title track (to facilitate the treatment).

    This is my (1st) problem:
    I would like to create in a UserForm, a list that would take over the names of avenues that we record. From this list, the user can select a name from one track to achieve various calculations thereafter (average value between cursor, max value, etc. ..).

    Thank you in advance for your reply
    Thanks in advance

    #8597
    Bernhard KantzBernhard Kantz
    Participant

    You can import your measurement data with a FlexPro import filter and create a VBA macro which renames your objects. E.g. you could use the Objects property of the folder object to access the imported objects in the FlexPro folder.
    Then you have the possibility to use the same templates for different measurements:
    To do this, you set up several folders in the database. Each folder contains the respective data sets from a certain measurement. You create the document objects and analysis objects in the parent folder. Here, it is important that the data sets from the various measurements are always given the same name.
    Now for example, before you update a document and thus trigger a calculation, activate the folder from which the data is to be taken using the (De)activate Folder command. All of the objects in the activated folder are then displayed in the parent folder. Therefore, FlexPro first searches in the activated folder for all data sets referenced in formulas, curves, etc., and then, if they are not found there, it searches within the parent folder.

    See also
    Flexpro Help
    Creating Templates for Analysis

    support@weisang.com

    #8598
    Bertrand SIMONBertrand SIMON
    Participant

    Merci pour cette réponse donc si je comprend bien, je ne peux pas créer une liste récapitulant les noms des voies enregistrées et en sélectionner une pour réaliser des calculs.
    Voici ma “userform”

    Les cases à gauches entourées de bleu sont des “commadbutton”. L’encadrer de droite entouré en rouge est une “listbox”.
    C’est dans la “ListBox” que je voudrais faire apparaitre mes voies exportées dans Flexpro 6. Sélectionner via un diagramme une partie de la courbe ( utilisation des curseurs ) et réaliser le calcul en cliquant sur un “commandButton”.

    Mon niveau en VBA est quasi nul et je souhaiterai avoir une ébauche de code pour réaliser mon projet. En faite, je n’ose pas demander le code complet.
    Voici un exemple avec très peu de voie d’une exportation:
    Dans ma macro, “Ubat, Ibat et Pbat” devront être placé dans la “listBox” et serviront pour les calculs futurs.

    Voila, j’espère être clair.

    Je compte sur vous et encore merci.

    #8599
    Bernhard KantzBernhard Kantz
    Participant

    Please be appreciative of the fact that we cannot give you the VBA code for this special project. But we offer a custom application development: https://weisang.com/en/products/engineering

    In the FlexPro help there are some VBA examples:
    – A Custom Import Filter
    – Displaying a Diagram on a From
    – Processing Events.

    Do you really need a VBA macro for your user case? You can select individul points or ranges with the cursors in a diagram and create a analysis object (e.g. maximum). The result of the analyis object is e.g. the maximum of the data range.

    support@weisang.com

    #8600
    Bertrand SIMONBertrand SIMON
    Participant

    Bonjour,
    par ces lignes en VBA je souhaite faire apparaitre une valeur moyenne de donnée sélectionné entre curseur dans un “label” (text box) sur un graphique.
    Voici le programme, mais il contient des erreurs:

    Dim point1 As Long
    Dim p1 As Long
    Dim point2 As Long
    Dim p2 As Long
    ActiveDatabase.ActiveObject.Cursor(1).Active = True
    p1 = ActiveDatabase.ActiveObject.ActiveCursor.PositionIndex
    ActiveDatabase.ActiveObject.Cursor(2).Active = True
    p2 = ActiveDatabase.ActiveObject.ActiveCursor.PositionIndex
    ActiveDatabase.ActiveObject.CursorActive = False
    Dim Moy
    Moy = fpObjectTypeStatisticQuantity
    .DataSet = “beber[p1, p2]”
    .Quantity = fpStatisticQuantityArithmeticMean
    .Update

    With ActiveDatabase.ActiveObject.Pages(1).AddTextLabel(120, -35)
    .Text = Moy
    .Select
    End With
    End Sub

    Pouvez vous m’indiquer mon erreur, s’il vous plait?

    Merci par avance.

    #8601
    Bernhard KantzBernhard Kantz
    Participant

    Try this code:

    
        ActiveDatabase.ActiveObject.Cursor(fpCursorMinX).Active = True
        p1 = ActiveDatabase.ActiveObject.ActiveCursor.PositionIndex
        ActiveDatabase.ActiveObject.Cursor(fpCursorMaxX).Active = True
        p2 = ActiveDatabase.ActiveObject.ActiveCursor.PositionIndex
        ActiveDatabase.ActiveObject.CursorActive = False
    
        Dim Moy As StatisticQuantityAnalysis
        Set Moy = ActiveDatabase.ActiveFolder.Add("Moy", fpObjectTypeStatisticQuantity)
        With Moy
            .DataSet = "beber[" & CStr(p1) & "," & CStr(p2) & "]"
            .Quantity = fpStatisticQuantityArithmeticMean
            .Update
        End With
    

    But in this case it’s easier to use FPScript instead of VBA!

    1) Create a FPScript formula ‘beberSection’:

    
    (beber)[Diagram.2D.Cursor(fpCursorMinX, 1).PositionIndex, Diagram.2D.Cursor(fpCursorMaxX, 1).PositionIndex]
    

    2) Create a Mean analysis object with the data set ‘beberSection’.

    If you change the position of the cursors FlexPro automatically recalculates the mean value of the new data part.

    support@weisang.com

    #8602
    Bertrand SIMONBertrand SIMON
    Participant

    MERCI BEAUCOUP!
    Plus que quelque ligne de code et mon projet sera terminé.
    Voici des lignes de code permettant de tracer une ligne avec des flèches aux chaque extrémités. Cette ligne représente l’écartement entre curseur.
    Ce code ne marche pas et je n’arrive pas à savoir pourquoi.

    ActiveDatabase.ActiveObject.Cursor(1).Active = True
    point1 = ActiveDatabase.ActiveObject.ActiveCursor.PositionX
    ActiveDatabase.ActiveObject.Cursor(2).Active = True
    point2 = ActiveDatabase.ActiveObject.ActiveCursor.PositionX
    With ActiveDatabase.ActiveObject.Pages(1).AddLine(point1, -20, point2, -20)
    .LineFormat.Arrowheads = fpArrowheadsBoth
    .Select
    End With
    ActiveDatabase.ActiveObject.Selection.Collapse
    ActiveDatabase.ActiveObject.Pages(1).Item(1).Select
    ActiveDatabase.ActiveObject.Selection.Collapse

    Merci de votre aide et de votre patience…

    #8603
    Bertrand SIMONBertrand SIMON
    Participant

    Merci pour votre reponse, ce code fonctionne à merveille mais n’est valable que pour une courbe de nom “beber”. J’ai voulu le rendre valable quelque soit la courbe sélectionnée dans un document de graphique 2D via le tableau des coordonnées. Ce code ne fonctionne pas, pourquoi?

    Dim p1 As Long
    Dim p2 As Long

    ActiveDatabase.ActiveObject.Cursor(fpCursorMinX).Active = True
    p1 = ActiveDatabase.ActiveObject.ActiveCursor.PositionIndex
    ActiveDatabase.ActiveObject.Cursor(fpCursorMaxX).Active = True
    p2 = ActiveDatabase.ActiveObject.ActiveCursor.PositionIndex
    courbe = ActiveDatabase.ActiveObject.ActiveCursor.Text

    Dim Moy As StatisticQuantityAnalysis
    Set Moy = ActiveDatabase.ActiveFolder.Add(“Moy”, fpObjectTypeStatisticQuantity)
    With Moy
    .DataSet = “courbe[” & CStr(p1) & “,” & CStr(p2) & “]”
    .Quantity = fpStatisticQuantityArithmeticMean
    .Update
    End With

    Merci d’avance

    #8604
    Bernhard KantzBernhard Kantz
    Participant

    This code only works if the digram is the active object in the database and the dataset (curve in the diagram) is “courbe”.

    support@weisang.com

    #8605
    Bertrand SIMONBertrand SIMON
    Participant

    Bonjour, je suis d’accord avec votre réponse mais comment rendre ce code valide quelque soit la courbe sélectionnée.

    Merci

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.