extraction type of feature

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • extraction type of feature

    Hello, I do need extract types of features used for 2d/3d dimensions. As per program example below:

    {DIM DIST8B= 3D DISTANCE FROM PLANE PLN1 TO CYLINDER CYL4,SHORTEST=OFF,NO_RADIUS UNITS=MM,$
    GRAPH=OFF TEXT=OFF MULT=10.00 OUTPUT=BOTH
    AX NOMINAL +TOL -TOL MEAS MAX MIN DEV OUTTOL
    M 1.433*1 0.55*1 0.2*1 1.433 1.433 1.433 0.000 0.000 --#-------
    FCFPROF3 =SURFACE PROFILE : PLN1}

    Here is distance between PLANE and CYLINDER. Any ideas how to extract types of features?

    P.S. I do have code which working without type of features, problem is that execution of script doing a lot of scan and it taking far too long. My goal is to execute code only if code is relevant with type of feature.
    Last edited by Darius11; 01-07-2020, 06:09 AM.

  • #2
    Edit: Sorry, I misread your question - the below code gets the *names* of the features, not the *type*. I guess you need to find the feature with the right name, and get the type from that.

    I don't know exactly how to do it in a script, but in plain PC-DMIS you do it with

    Code:
    DIM DIST1= 2D DISTANCE FROM PLANE PLN4 TO CYLINDER CYL1     (CENTER TO CENTER),NO_RADIUS  UNITS=MM,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=BOTH
    AX    NOMINAL       MEAS       +TOL       -TOL        DEV     OUTTOL
    M        1.256      1.256      0.000      0.000      0.000      0.000 #--------
                ASSIGN/V1=GETCOMMAND(1107, "UP", 1)
                ASSIGN/V2=GETTEXT("Reference Id", 1, V1)
                ASSIGN/V3=GETTEXT("Reference Id", 2, V1)
    Last edited by AndersI; 01-07-2020, 08:05 AM.
    AndersI
    SW support - Hexagon Metrology Nordic AB

    Comment


    • AndersI
      AndersI commented
      Editing a comment
      If you have the name of the feature you can locate the command that creates the feature. From this command you can extract the feature type.

    • Darius11
      Darius11 commented
      Editing a comment
      Could you please add small example how to get TYPE for (REF_ID, 1) or (REF_ID, 2)? (REF_ID, 1) is first feature for dimension, (REF_ID, 2) is second feature.

    • AndersI
      AndersI commented
      Editing a comment
      Actually, the "can" in my previous message is more of a "should be able to" - I'm almost certain I have extracted type info in some old Excel macro, but I can't find it atm.

  • #3
    Personally I have done it by looping through the program and build up a table containing references to all features in the program. When I need data for a feature I just look it up in the table and call the command.type function. It will give you an integer, there is a list in the documentation regarding that. You should be aware that the type is usually rather specific, there are for instance a bunch of different cylinder feature types. (Including constructed features. Which may have different internal representations, watch out if extracting data from cylinders, hits are fine though in my experience.)

    Comment


    • Darius11
      Darius11 commented
      Editing a comment
      Problem with TYPE of feature I did solve by using first 3 letters of feature ID. It do work good enough, just need to ensure that default feature ID will stay the same. TYPE I needed to ensure that will be executed only part of code related with certain type of feature.

      Problem with time of execution I did solve by exporting data of features to table in excel (looping) and then looping trough basic dimensions and searching for data in table by REF_ID. Seems like I'am done in similar way as you did.

    • LostL
      LostL commented
      Editing a comment
      Yes. What datastructure do you use in excel?

  • #4
    My data structure is very simple, it contains 3 columns.
    1-st column contains ID of constructed SET features (SCN1, SCN2 ....) which is used for profile outputs
    2-nd contains ID's of points which was used to create SET features, planes, lines, and circles
    3-rd contains tolerances of TP and profile.
    Basically in first step, script looking in the CMM program for TP output and populating REF_ID to excel 2-nd column and tolerance to excel 3-rd column. In second step script looking in the CMM program for constructed set features then to excel 1-st column adding SET ID (SCN1, SCN2 ....) to 2-nd column populating ID's of all points used to create SCN and in 3-rd column populating tolerance of profile. In third step script looking in the CMM program for constructed lines, planes and circles then by using constructed feature REF_ID in excel 2-nd column looking for matching feature ID, when feature have been found then script copying profile tolerance of SCN feature and populating to third column and ID to 2-nd column.
    2-nd column I do use for calculation of tolerances of basic dimensions.

    [
    CYL2 CYL2 0.35
    SCN2 PNT31 0.5
    SCN2 PNT30 0.5
    CIR1 0.3
    ]

    Comment


    • #5
      Fast enough for the programs you run?

      Comment


      • LostL
        LostL commented
        Editing a comment
        Running with hidden PC-DMIS?

      • vpt.se
        vpt.se commented
        Editing a comment
        Script? Where?

      • LostL
        LostL commented
        Editing a comment
        Slow head today, you need to elaborate.

    • #6
      No, I do not hide Pc-dmis to run script.

      LostL do you have script with similar purpose? As I see from experience, if included a lot of scan "For Each Command In Commands" then it may lead to problem, because full scan will be repeated for every single feature and sub feature. As example distance point to plane. For point need to do full scan of CMM program for "constructed set features" then check if "constructed set features" contains exact point and then scan for "constructed set features" in profile output for profile tolerance. For plane need to check if "constructed set features" contain REF-ID of plane, then full scan for at least one REF-ID of "constructed set features" and then scan for profile output of "constructed set features". Only after scans will be added tolerances and that is long process (at least for me).

      I do use Pc-dmis 2015.1 offline and CPU i5-4400.

      To vpt.se
      Script is a fox, so where fox could be...

      Comment


      • #7
        Turning .visible off dramatically improves performance.

        edit: Most of my post was cut.

        Avoid for each, use an integer counter and .item to retrieve commands.

        Yeah, extracting geometrical information.

        edit2:
        Personally I loop through the program once, building up a reference table as I go. I then use the table to access the features related to whatever dimension found.
        Last edited by LostL; 02-17-2020, 11:38 AM.

        Comment

        Related Topics

        Collapse

        Working...
        X