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


  • Love this.

    Can you add what I would need to do if I want to do multiple VIEWSETS for the same feature?


    Just to be clear, this isn't my code. I just saw JackMindo's post and thought it was cool enough that it needed a bump.
    Also, he went through the trouble of color coding his code, but the formatting was all messed up when it was posted in a CODE wrapper.
    I was just "remastering" the code to show it as the artist intended it to be seen.

    It seems like it would work fine with more than one viewset command or even the more modern Snapshot commands.
    I'd put them in the same place as the original viewset. See below in Orange
    ASSIGN/COUNT=0
    SCN1START =LABEL/

    IF/COUNT==0

    [INDENT=2] ASSIGN/TOGGLE="BOTH"
    ASSIGN/
    SWITCH="BOTH"
    [/INDENT]
    END_IF/

    IF/COUNT==1

    [INDENT=2] ASSIGN/TOGGLE="OFF"
    ASSIGN/SWITCH="NONE"
    [/INDENT]
    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
    SCNVIEW2 =VIEWSET/
    RECALL/VIEWSET,SCNVIEW2

    SCNVIEW3 =VIEWSET/
    RECALL/VIEWSET,SCNVIEW3


    IF/COUNT==0

    [INDENT=2] DISPLAY/METAFILE, "", TO FIT, GOOD[/INDENT]
    END_IF/

    IF/COUNT==0

    [INDENT=2] ASSIGN/COUNT=COUNT+1
    GOTO/SCN1START
    [/INDENT]
    END_IF/

Reply Children
No Data