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.
  • i was able to do it but changed the code 

    Moved feature and characteristic into first if - because in case as it its program will measure and report it twice (the feature can be created before this code stars with no problem) another problem is caused by quite not friendly behavior of PC-PROBLEM and i do not fully understand it, but!:::: after measuring its printing characteristic with actual view so its pringing with probe on part. Added clearance plane movement it was moving from part but pc-dmis was printing report with probe (because calculations are faster than movement i think) so i added some incremental movement to make pc some weird "thinking" just to get some time before to move probe before print starts 

    Strange in first case one clearance movement + 1mm incremental  movement sufficient while on second characteristic it was necessary to add incremental movement about 15mm i wonder how it will work on faster pc (hahaha)

    Maybe its some better and smarter solution for this ?  maybe there is some function like "wait for 1s before doing next action"  ?? 

    I'm showing my results and code produced it results  - its in Polish but if someone will be interested i will translate if to english in free time (please do not ask about measuring plane and flatness on thorus surface - its just for learning :) ) Also i believe what doing this may be not so much time consuming after doing few step: 1completely understanding part of code what is necessary here 2 creating a kind of template to copy past into pc-dmis before and after each characteristic 

    I believe will do it in some future ( more far future than close ) and can share it if somebody will ask. I was able to do this in about 6 hours time also i have some programming experience so its easier for me to catch the code for people without it, also understand what doing this things may be nightmare but doing hard things is worth of it. whenever the same can be done within just 10 clicks on another software :)  

    the dark magic: 

    $$ NIE,
                tu zaczyna sie kod 
                
                PRZYPORZ/V1=0
    SCSTART    =ETYKIETA/
                JEŚLI/V1==0
                  PRZYPORZ/TOGLE="WŁ"
                  PRZYPORZ/SWITCH="OBA"
    PL TEST      =ELEM/STYK/PŁASZCZYZNA/DOMYŚLNE,KARTEZJAŃSKI,OBRYS,MIN_SEP
                  TEOR/<0,0,0>,<0,0,1>
                  RZECZ/<-0.01,0,-0.002>,<0.002815,0.0016915,0.9999946>
                  DOCEL/<0,0,0>,<0,0,1>
                  WEKTOR KĄTA=<0,-1,0>,Promieniowy
                  POKAŻ PARAMETRY ELEMENTU=NIE
                  POKAŻ PARAMETRY STYKU=TAK
                    LICZPKT=6,LICZWIERSZY=1
                    ODSTĘP=6.5
                    RUCH OMINIĘCIA=NIE,ODLEGŁOŚĆ=10
                  POKAŻ PKTPOM=NIE
                  RUCH/PŁ_BEZPIECZ
                  RUCH/PRZYROST,<0,0,1>
                ZAKOŃCZ_JEŚLI/
                JEŚLI/V1==1
                  PRZYPORZ/TOGLE="WYŁ"
                  PRZYPORZ/SWITCH="ŻADEN"
                ZAKOŃCZ_JEŚLI/
    FLATNESS PL TEST =PŁASKOŚĆ : PL TEST
                RAMKKONTROLELEM/POKAŻPARAM=TAK,POKAŻROZSZERZONE=TAK
                GRAFIKACAD=TOGLE,GRAFIKARAPORT=WYŁ,TEKST=WYŁ,WIELO=500.00,GĘSTOŚĆSTRZAŁEK=100,WYJŚCIE=SWITCH,JEDNOSTKI=MM
                NA JEDNOSTKĘ=NIE,
                TYPSTANDARDOWY=ISO_1101
                  WYMIAR/PŁASKOŚĆ,0.01
                  UWAGA/FLATNESS PL TEST
                ELEMENTY/PL TEST,,
                RUCH/PŁ_BEZPIECZ
                RUCH/PŁ_BEZPIECZ
                RUCH/PŁ_BEZPIECZ
    WIDOKI1    =WIDOKI
                PRZYWOŁAJ/WIDOK,WIDOKI1
                JEŚLI/V1==0
                  WYŚWIETL/METAPLIK, "", WPASUJ, DOBRA
                  PRZYPORZ/V1=V1+1
                IDŹDO/SCSTART
                ZAKOŃCZ_JEŚLI/
    $$ NIE,
                koniec kodu 1 i poczatek kodu 2 
                
                PRZYPORZ/V2=0
    L2         =ETYKIETA/
                JEŚLI/V2==0
                  PRZYPORZ/TOGLE2="WŁ"
                  PRZYPORZ/SWITCH2="OBA"
                  RUCH/PŁ_BEZPIECZ
    PL TEST 2    =ELEM/STYK/PŁASZCZYZNA/DOMYŚLNE,KARTEZJAŃSKI,OBRYS,MIN_SEP
                  TEOR/<0,0,0>,<0,0,1>
                  RZECZ/<-0.005,0.001,-0.184>,<0.0012153,0.0008602,0.9999989>
                  DOCEL/<0,0,0>,<0,0,1>
                  WEKTOR KĄTA=<0,-1,0>,Promieniowy
                  POKAŻ PARAMETRY ELEMENTU=NIE
                  POKAŻ PARAMETRY STYKU=TAK
                    LICZPKT=6,LICZWIERSZY=1
                    ODSTĘP=8
                    RUCH OMINIĘCIA=NIE,ODLEGŁOŚĆ=10
                  POKAŻ PKTPOM=NIE
                  RUCH/PŁ_BEZPIECZ
                  RUCH/PRZYROST,<15,0,0>
                  RUCH/PŁ_BEZPIECZ
      FLATNESS TEST 2 =PŁASKOŚĆ : PL TEST 2
                  RAMKKONTROLELEM/POKAŻPARAM=TAK,POKAŻROZSZERZONE=TAK
                  GRAFIKACAD=TOGLE2,GRAFIKARAPORT=WYŁ,TEKST=WYŁ,WIELO=400.00,GĘSTOŚĆSTRZAŁEK=100,WYJŚCIE=SWITCH2,JEDNOSTKI=MM
                  NA JEDNOSTKĘ=NIE,
                  TYPSTANDARDOWY=ISO_1101
                    WYMIAR/PŁASKOŚĆ,0.01
                    UWAGA/FLATNESS TEST 2
                  ELEMENTY/PL TEST 2,,
                  RUCH/PŁ_BEZPIECZ
                ZAKOŃCZ_JEŚLI/
                JEŚLI/V2==1
                  PRZYPORZ/TOGLE="WYŁ"
                  PRZYPORZ/SWITCH="ŻADEN"
                ZAKOŃCZ_JEŚLI/
    WIDOKI2    =WIDOKI
                PRZYWOŁAJ/WIDOK,WIDOKI2
                JEŚLI/V2==0
                  WYŚWIETL/METAPLIK, "", WPASUJ, DOBRA
                  PRZYPORZ/V2=V2+1
                IDŹDO/L2
                ZAKOŃCZ_JEŚLI/
                KOMENTARZ/RAPT,
                
                
                
                koniec raportu