hexagon logo

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.
  • 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

    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)
    
  • I see in a plain pc-dmis program "FROM PLANE PLN4 TO CYLINDER CYL1" and by seeing that I'm assuming that should exist command which in conjunction with feature ((REF_ID, 1) or (REF_ID, 2)) should give output of type of feature (es example type of (REF_ID,1)). My problem is that by having name of feature as example (REF_ID, 1) I can't manage to get type of feature.
  • 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.
  • 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.
  • 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.
  • 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.)
  • 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.
  • Yes. What datastructure do you use in excel?
  • 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.

    [ [TABLE="border: 0, cellpadding: 0, cellspacing: 0"]
    [TR]
    [TD="width: 64"]CYL2[/TD]
    [TD="width: 64"]CYL2[/TD]
    [TD="width: 64, align: right"]0.35[/TD]
    [/TR]
    [TR]
    [TD]SCN2[/TD]
    [TD]PNT31[/TD]
    [TD="align: right"]0.5[/TD]
    [/TR]
    [TR]
    [TD]SCN2[/TD]
    [TD]PNT30[/TD]
    [TD="align: right"]0.5[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]CIR1[/TD]
    [TD="align: right"]0.3[/TD]
    [/TR]
    [/TABLE]
    ]