hexagon logo

Turn off CAD graphs programatically

UPDATE: I've added the SWITCH variable as it was displaying the dimension result twice.



This is one of those really niche tips that might help out one maybe two people but I thought it was quite cool. When using the CAD graphs for surface profiles it has always bugged me that they stay active resulting in a messy report after several dimensions. I have found a way to capture the CADGRAPH, display it on the report and then turn it off again afterwards before displaying the next feature Slight smile


[COLOR=#EE82EE]ASSIGN/COUNT=0[/COLOR]
SCN1START      =LABEL/
[COLOR=#EE82EE]IF/COUNT==0
                  ASSIGN/[/COLOR][B][COLOR=#FF0000]TOGGLE[/COLOR][/B][COLOR=#EE82EE]="BOTH"
                  ASSIGN/[/COLOR][B][COLOR=#008000]SWITCH[/COLOR][/B][COLOR=#EE82EE]="BOTH"
                END_IF/[/COLOR]
[COLOR=#0000FF]    IF/COUNT==1
                  ASSIGN/[/COLOR][B][COLOR=#FF0000]TOGGLE[/COLOR][/B][COLOR=#0000FF]="OFF"[/COLOR]
[COLOR=#0000CD]ASSIGN/[/COLOR][B][COLOR=#008000]SWITCH[/COLOR][/B][COLOR=#0000FF]="NONE"
                END_IF/[/COLOR]

SCN1           =FEAT/SET,CARTESIAN
                THEO/<21.723,21.584,2.446>,<0,0,1>
                ACTL/<21.677,21.586,2.247>,<0,0,1>
                CONSTR/SET,BASIC,P8--(1),P9--(1),P10--(1),P11--(1),P12--(1),P13--(1),,

    FCFPROF1 =SURFACE PROFILE : SCN1
                FEATCTRLFRAME/SHOWPARAMS=YES,SHOWEXPANDED=YES
                CADGRAPH=[B][SIZE=14px][COLOR=#FF0000]TOGGLE[/COLOR][/SIZE][/B],REPORTGRAPH=OFF,TEXT=OFF,MULT=10.00,ARROWDENSITY=100,OUTPUT=[SIZE=14px][B][COLOR=#008000]SWITCH[/COLOR][/B][/SIZE],UNITS=MM
                COMPOSITE=NO,
                CUSTOMIZED DRF=NO
                STANDARDTYPE=ASME_Y14_5
                  PRIMARY DIMENSION/PROFILE OF SURFACE,1,UNEQUAL TOLERANCE ZONE,0.7,A1,<dat>,<dat>
                  NOTE/FCFPROF1
                FEATURES/SCN1,,
                COMMENT/REPT,

SCNVIEW1       =VIEWSET/
                RECALL/VIEWSET,SCNVIEW1
[COLOR=#EE82EE]IF/COUNT==0
                  DISPLAY/METAFILE, "", TO FIT, GOOD
                END_IF/[/COLOR]
[COLOR=#0000FF]IF/COUNT==0
                  ASSIGN/COUNT=COUNT+1
                GOTO/SCN1START
              END_IF/[/COLOR]



This allows you to use CADGRAPH and end up with a clean and crisp report that only shows one profile on each screen capture.


Warning: I use this in a program that has 84 surface profile callouts, while it works perfectly it does dramatically increase saving and loading time.
Parents
  • I thought this was a clever workaround.
    Here is the code re-posted with the formatting fixed.

    ASSIGN/COUNT=0
    SCN1START =LABEL/
    IF/COUNT==0
    ASSIGN/
    TOGGLE="BOTH"
    ASSIGN/
    SWITCH="BOTH"
    END_IF/

    IF/COUNT==1 ASSIGN/TOGGLE="OFF"
    ASSIGN/SWITCH="NONE"
    END_IF/


    SCN1 =FEAT/SET,CARTESIAN
    THEO/<21.723,21.584,2.446>,<0,0,1>
    ACTL/<21.677,21.586,2.247>,<0,0,1>
    CONSTR/SET,BASIC,P8--(1),P9--(1),P10--(1),P11--(1),P12--(1),P13--(1),,

    FCFPROF1 =SURFACE PROFILE : SCN1 FEATCTRLFRAME/SHOWPARAMS=YES,SHOWEXPANDED=YES CADGRAPH=TOGGLE,REPORTGRAPH=OFF,TEXT=OFF,MULT=10.00,ARROWDENSITY= 100,OUTPUT=SWITCH,UNITS=MM COMPOSITE=NO, CUSTOMIZED DRF=NO STANDARDTYPE=ASME_Y14_5 PRIMARY DIMENSION/PROFILE OF SURFACE,1,UNEQUAL TOLERANCE ZONE,0.7,A1,<dat>,<dat> NOTE/FCFPROF1 FEATURES/SCN1,, COMMENT/REPT,

    SCNVIEW1 =VIEWSET/
    RECALL/VIEWSET,SCNVIEW1
    IF/COUNT==0 DISPLAY/METAFILE, "", TO FIT, GOOD END_IF/
    IF/COUNT==0 ASSIGN/COUNT=COUNT+1 GOTO/SCN1START END_IF/


Reply Children
No Data