hexagon logo

Settogglestring

Hello all,
Is there some documentation on the settogglestring method.
I am curious about the parameter values and how to set them
accordingly.
Thanks in advance for any help or info.
  • For the icon on use this

    ' Set Show Ids Item 1 = ICON
    retval = DmisCommand.SetToggleString (1, SHOW_IDS, 1)


    For the icon off use this

    ' Set Show Ids Item 1 =
    retval = DmisCommand.SetToggleString (6, SHOW_IDS, 1)


    Why it's '6' I have no idea.


    Handy little trick for this type thing btw.

    1) Get notepad++ (if you haven't yet)
    2) From plugins menu select Plugins Admin and search for and install 'Compare'
    3) From PCDMIS export the .bas with the option in question set one way, and then the other
    4) Open both files in notepad++ and from the plugins menu select compare, then compare


    Well done
  • For the icon on use this

    ' Set Show Ids Item 1 = ICON
    retval = DmisCommand.SetToggleString (1, SHOW_IDS, 1)


    For the icon off use this

    ' Set Show Ids Item 1 =
    retval = DmisCommand.SetToggleString (6, SHOW_IDS, 1)


    Why it's '6' I have no idea.


    Handy little trick for this type thing btw.

    1) Get notepad++ (if you haven't yet)
    2) From plugins menu select Plugins Admin and search for and install 'Compare'
    3) From PCDMIS export the .bas with the option in question set one way, and then the other
    4) Open both files in notepad++ and from the plugins menu select compare, then compare


    thank you very much.
    but my current code is just like you mentioned,and of cource,that does not work

    Command LocationCmd4 = pcdCommands.Add(pcdOBT.DIMENSION_INFORMATION, true);
    LocationCmd4.Marked = true;
    LocationCmd4.PutText("LOC22", pcdEFT.REF_ID, 0);
    LocationCmd4.SetToggleString(6, pcdEFT.SHOW_IDS, 1);
    LocationCmd4.SetToggleString(6, pcdEFT.SHOW_IDS, 2);
    LocationCmd4.SetToggleString(1, pcdEFT.SHOW_HEADINGS, 0);
    LocationCmd4.SetToggleString(1, pcdEFT.GRAPH_OPTION, 0);
    LocationCmd4.SetToggleString(4, pcdEFT.DIM_INFO_ORDER, 1);
    LocationCmd4.SetToggleString(14, pcdEFT.DIM_INFO_LOC, 1);
    LocationCmd4.ReDraw();
  • What's pcdEFT?

    Is this a script (.BAS) or in VBA (excel) or VB.net? or something else - you have ; as a line terminator?

    If it was a script (.bas at least) and you're calling SetToggleString as a method (which isn't returning anything) rather than a function which is (retval =) then I you need to drop the parenthesis.


    LocationCmd4.SetToggleString 6, SHOW_IDS, 2
  • Hi,
    based on tip, i tryed again

    with 1 and 2 it is not working ?
    but it seems that a 3 do it ^^
    DmisCommand.SetToggleString (6, SHOW_IDS, 3)

    is this complete random ? how strange


    Sub Main
    Dim DmisApp As Object
    Dim DmisPart As Object
    Dim DmisCommands As Object
    Dim DmisCommand As Object
    
    
    Set DmisApp = CreateObject("PCDLRN.Application")
    Set DmisPart = DmisApp.ActivePartProgram
    Set DmisCommands = DmisPart.Commands
    CommandCount = DmisCommands.Count
    Set DmisCommand = DmisCommands.Item(CommandCount)
    DmisCommands.InsertionPointAfter DmisCommand
    
    
    Set DmisCommand = DmisCommands.Add(DIMENSION_INFORMATION, True)
    DmisCommand.Marked = True
    retval = DmisCommand.PutText ("LOC1", REF_ID, 0)
    
    retval = DmisCommand.SetToggleString (6, SHOW_IDS, 3)
    retval = DmisCommand.SetToggleString (0, SHOW_IDS, 1)
    retval = DmisCommand.SetToggleString (0, SHOW_IDS, 2)
    retval = DmisCommand.SetToggleString (1, SHOW_HEADINGS, 0)
    retval = DmisCommand.SetToggleString (1, GRAPH_OPTION, 0)
    retval = DmisCommand.SetToggleString (4, DIM_INFO_ORDER, 1)
    retval = DmisCommand.SetToggleString (14, DIM_INFO_LOC, 1)
    End Sub
    


    with pcDMIS 2020 R1 this will work,
    you only have to alter "LOC1"
  • perfect!thank you very much!
    is there any documents about such commands?

    all guys really did me a big favor,thank you all!
  • Weird - the .bas export is obviously knackered.

    However if you change the pop up display in the edit window to 'data type information' and hover over the 'Icon' field, you can see that they type index is indeed 3
  • Hello all,
    I revisited this post and got the answer I needed.

    This code snippet added to my script produces what I wanted.
    Cmd.SetToggleString 6, SHOW_IDS, 3
    Cmd.SetToggleString 0, SHOW_IDS, 1
    Cmd.SetToggleString 0, SHOW_IDS, 2​


    The following is generated in the program when the "T" value in the dimension
    block is out of tolerance.
    Before, I was getting the feature ID also, but now FeatID is not displayed.

    DIMINFO/LOC319; , , ,VERT,HORIZ, ,$
    , ;DEV, , , , , , , , ,$
    T, , , , , , , , , , , , , , , , ,​

    Thanks Henniger123 and to all who worked on the problem.
  • I found a solution that works in my case.

    Set PCDCommand = PCDCommands.Add(DIMENSION_INFORMATION, True)
    PCDCommand.Marked = True

    retval = PCDCommand.PutText("D1", REF_ID, 0)
    retval = PCDCommand.SetToggleString(0, SHOW_IDS, 1)
    retval = PCDCommand.SetToggleString(0, SHOW_IDS, 2)
    retval = PCDCommand.SetToggleString(6, SHOW_IDS, 3)
    retval = PCDCommand.SetToggleString(0, SHOW_IDS, 4)
    retval = PCDCommand.SetToggleString(0, SHOW_IDS, 5)
    retval = PCDCommand.SetToggleString(0, SHOW_IDS, 6)
    retval = PCDCommand.SetToggleString(1, SHOW_HEADINGS, 0)