occ中natvis的使用

occt.natvis

<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">

  <Type Name="opencascade::handle&lt;*&gt;">
    <DisplayString Condition="entity==0x00000000"> nullptr </DisplayString>
    <DisplayString> {(void*)entity} [cnt={entity->count} {*entity}] </DisplayString>
    <Expand>
      <ExpandedItem>(opencascade::handle&lt;$T1&gt;::element_type*)entity</ExpandedItem>
    </Expand>
  </Type>

  <!-- math package -->
  <Type Name="math_SingleTab&lt;*&gt;">
    <DisplayString Condition="Last &lt; First"> empty </DisplayString>
    <DisplayString>{{ size = {Last - First + 1} }}</DisplayString>
    <Expand>
      <Item Condition="Last >= First" Name="[size]"> Last - First + 1 </Item>
      <ArrayItems Condition="Last >= First">
        <Size>Last - First + 1</Size>
        <ValuePointer>($T1*)(Addr) + First</ValuePointer>
      </ArrayItems>
    </Expand>
  </Type>

  <Type Name="math_DoubleTab">
    <DisplayString Condition="UppC &lt; LowC || UppR &lt; LowR"> empty </DisplayString>
    <DisplayString>{{ extent = ({ UppR-LowR+1 }, { UppC-LowC+1 }) }}</DisplayString>
    <Expand>
      <ArrayItems>
        <Direction>Forward</Direction>
        <Rank>2</Rank>
        <Size>$i == 0 ? (UppR - LowR + 1) : (UppC - LowC + 1) </Size>
        <ValuePointer> (Standard_Real*)Addr </ValuePointer>
      </ArrayItems>
    </Expand>
  </Type>

  <Type Name="math_Vector">
    <DisplayString Condition="UpperIndex &lt; LowerIndex"> empty </DisplayString>
    <DisplayString>{{ size = {UpperIndex - LowerIndex + 1} }}</DisplayString>
    <Expand>
      <ExpandedItem> Array </ExpandedItem>
    </Expand>
  </Type>

  <Type Name="math_Matrix">
    <DisplayString Condition="UpperColIndex &lt; LowerColIndex || UpperRowIndex &lt; LowerRowIndex"> empty </DisplayString>
    <DisplayString>{{ extent = ({ UpperRowIndex-LowerRowIndex+1 }, { UpperColIndex-LowerColIndex+1 } ) }}</DisplayString>
    <Expand>
      <ExpandedItem> Array </ExpandedItem>
    </Expand>
  </Type>
  
  <!-- gp package -->
  <Type Name="gp_XY">
    <DisplayString>[{(float)x} {(float)y}]</DisplayString>
  </Type>

  <Type Name="gp_XYZ">
    <DisplayString>[{(float)x} {(float)y} {(float)z}]</DisplayString>
  </Type>
  
  <Type Name="gp_Pnt2d">
    <AlternativeType Name="gp_Vec2d"/>
    <AlternativeType Name="gp_Dir2d"/>
    <DisplayString>{{ x = {(float)coord.x}, y = {(float)coord.y} }}</DisplayString>
    <Expand>
      <Item Name="x"> coord.x </Item>
      <Item Name="y"> coord.y </Item>
    </Expand>
  </Type>

  <Type Name="gp_Ax2d">
    <DisplayString>{{ Axis2: location = {loc}, direction = {vdir} }}</DisplayString>
    <Expand>
      <Item Name="location"> loc </Item>
      <Item Name="direction"> vdir </Item>
    </Expand>
  </Type>

  <Type Name="gp_Ax22d">
    <DisplayString>{{ Csys2d: location = {point}, xdirection = {vxdir}, ydirection = {vydir} }}</DisplayString>
    <Expand>
      <Item Name="location"> point </Item>
      <Item Name="xdirection"> vxdir </Item>
      <Item Name="ydirection"> vydir </Item>
    </Expand>
  </Type>

  <Type Name="gp_Mat2d">
    <Expand>
      <ExpandedItem> matrix </ExpandedItem>
    </Expand>
  </Type>

  <Type Name="gp_Lin2d">
    <DisplayString>{{ line2d: location = {pos.loc}, direction = {pos.vdir} }}</DisplayString>
    <Expand>
      <ExpandedItem> pos </ExpandedItem>
    </Expand>
  </Type>

  <Type Name="gp_Circ2d">
    <DisplayString>{{ circle2d: location = {pos.point}, radius = {radius} }}</DisplayString>
    <Expand>
      <ExpandedItem> pos </ExpandedItem>
      <Item Name="radius"> radius </Item>
    </Expand>
  </Type>

  <Type Name="gp_Elips2d">
    <DisplayString>{{ ellipse2d: location = {pos.point}, majorRadius = {majorRadius}, minorRadius = {minorRadius} }}</DisplayString>
    <Expand>
      <ExpandedItem> pos </ExpandedItem>
      <Item Name="majorRadius"> majorRadius </Item>
      <Item Name="minorRadius"> minorRadius </Item>
    </Expand>
  </Type>
  
  <Type Name="gp_Pnt">
    <AlternativeType Name="gp_Vec"/>
    <AlternativeType Name="gp_Dir"/>
    <DisplayString>{{ x = {(float)coord.x}, y = {(float)coord.y}, z = {(float)coord.z} }}</DisplayString>
    <Expand>
      <Item Name="x"> coord.x </Item>
      <Item Name="y"> coord.y </Item>
      <Item Name="z"> coord.z </Item>
    </Expand>
  </Type>

  <Type Name="gp_Ax1">
    <DisplayString>{{ Axis3: location = {loc}, direction = {vdir} }}</DisplayString>
    <Expand>
      <Item Name="location"> loc </Item>
      <Item Name="direction"> vdir </Item>
    </Expand>
  </Type>

  <Type Name="gp_Ax2">
    <AlternativeType Name="gp_Ax3"/>
    <DisplayString>{{ Csys3: location = {axis.loc}, normal = {axis.vdir} }}</DisplayString>
    <Expand>
      <Item Name="location"> axis.loc </Item>
      <Item Name="normal"> axis.vdir </Item>
      <Item Name="xdirection"> vxdir </Item>
      <Item Name="ydirection"> vydir </Item>
    </Expand>
  </Type>

  <Type Name="gp_Mat">
    <Expand>
      <ExpandedItem> matrix </ExpandedItem>
    </Expand>
  </Type>

  <Type Name="gp_Lin">
    <DisplayString>{{ line: location = {pos.loc}, direction = {pos.vdir} }}</DisplayString>
    <Expand>
      <ExpandedItem> pos </ExpandedItem>
    </Expand>
  </Type>

  <Type Name="gp_Circ">
    <DisplayString>{{ circle: location = {pos.axis.loc}, radius = {radius}, normal = {pos.axis.vdir} }}</DisplayString>
    <Expand>
      <ExpandedItem> pos </ExpandedItem>
      <Item Name="radius"> radius </Item>
    </Expand>
  </Type>

  <Type Name="gp_Elips">
    <DisplayString>{{ ellipse: location = {pos.axis.loc}, majorRadius = {majorRadius}, minorRadius = {minorRadius}, normal = {pos.axis.vdir} }}</DisplayString>
    <Expand>
      <ExpandedItem> pos </ExpandedItem>
      <Item Name="majorRadius"> majorRadius </Item>
      <Item Name="minorRadius"> minorRadius </Item>
    </Expand>
  </Type>

  <Type Name="gp_Pln">
    <DisplayString>{{ plane: location = {pos.axis.loc}, normal = {pos.axis.vdir} }}</DisplayString>
    <Expand>
      <ExpandedItem> pos </ExpandedItem>
    </Expand>
  </Type>

  <!-- NCollection package -->
  
  <Type Name="TCollection_AsciiString">
    <DisplayString>{mylength}: {mystring,s}</DisplayString>
  </Type>
  
  <Type Name="TCollection_ExtendedString">
    <DisplayString>{mylength}: {mystring,su}</DisplayString>
  </Type>

  <Type Name="NCollection_Array1&lt;*&gt;">
    <DisplayString Condition="myUpperBound &lt; myLowerBound"> empty </DisplayString>
    <DisplayString>{{ size = {myUpperBound - myLowerBound + 1} }}</DisplayString>
    <Expand>
      <Item Condition="myUpperBound >= myLowerBound" Name="[size]"> myUpperBound - myLowerBound + 1 </Item>
      <Item Condition="myUpperBound >= myLowerBound" Name="[deletable]"> myDeletable </Item>
      <ArrayItems Condition="myUpperBound >= myLowerBound">
        <Size>myUpperBound - myLowerBound + 1</Size>
        <ValuePointer>myData + myLowerBound</ValuePointer>
      </ArrayItems>
    </Expand>
  </Type>

  <Type Name="NCollection_Array2&lt;*&gt;">
    <DisplayString Condition="myUpperCol &lt; myLowerCol || myUpperRow &lt; myLowerRow"> empty </DisplayString>
    <DisplayString>{{ extent = ({ myUpperRow-myLowerRow+1 }, { myUpperCol-myLowerCol+1 }) }}</DisplayString>
    <Expand>
      <ArrayItems>
        <Direction>Forward</Direction>
        <Rank>2</Rank>
        <Size>$i == 0 ? (myUpperRow - myLowerRow + 1) : (myUpperCol - myLowerCol + 1) </Size>
        <ValuePointer> myStart </ValuePointer>
      </ArrayItems>
    </Expand>
  </Type>

  <Type Name="NCollection_Sequence&lt;*&gt;">
    <DisplayString Condition="mySize == 0"> empty </DisplayString>
    <DisplayString>{{ size = { mySize } }}</DisplayString>
    <Expand>
      <LinkedListItems Condition="mySize != 0">
        <Size> mySize  </Size>
        <HeadPointer>myFirstItem</HeadPointer>
        <NextPointer>myNext</NextPointer>
        <ValueNode>*($T1*)(sizeof(NCollection_SeqNode) + ((char *)this))</ValueNode>
      </LinkedListItems>
    </Expand>
  </Type>
  
  <Type Name="NCollection_Vector&lt;*&gt;">
      <DisplayString>NCollection_Vector [{myLength}]</DisplayString>
      <Expand>
          <IndexListItems Condition="myData->Length&lt;myLength">
              <Size>myData->Length</Size>
              <ValueNode>*($T1*)((char*)myData->DataPtr + $i * myItemSize)</ValueNode>
          </IndexListItems>
          <IndexListItems Condition="myData->Length&gt;=myLength">
              <Size>myLength</Size>
              <ValueNode>*($T1*)((char*)myData->DataPtr + $i * myItemSize)</ValueNode>
          </IndexListItems>
      </Expand>
  </Type>

  <Type Name="NCollection_List&lt;*&gt;">
    <DisplayString>NCollection_List [{myLength}]</DisplayString>
    <Expand>
      <LinkedListItems>
        <Size>myLength</Size>
        <HeadPointer>myFirst</HeadPointer>
        <NextPointer>myNext</NextPointer>
        <ValueNode>*($T1*)(sizeof(NCollection_ListNode) + ((char *)this))</ValueNode>
      </LinkedListItems>
    </Expand>
  </Type>

  <Type Name="NCollection_Map&lt;*&gt;">
    <DisplayString>NCollection_Map [{mySize}]</DisplayString>
    <Expand>
      <CustomListItems MaxItemsPerView="120" ExcludeView="Test">
        <Variable Name="iBucket" InitialValue="0"/>
        <Variable Name="pData" InitialValue="myData1"/>

        <Size> mySize </Size>
        <Loop>
          <Break Condition="iBucket > myNbBuckets"/>
          <If Condition="pData[iBucket] != nullptr">
            <Item> (MapNode*)pData[iBucket]</Item>
          </If>
          <Exec>iBucket = iBucket + 1</Exec>
        </Loop>
      </CustomListItems>
    </Expand>
  </Type>

  <Type Name="NCollection_DataMap&lt;*&gt;">
    <DisplayString>NCollection_DataMap [{mySize}]</DisplayString>
    <Expand>
      <CustomListItems MaxItemsPerView="120" ExcludeView="Test">
        <Variable Name="iBucket" InitialValue="0"/>
        <Variable Name="pData" InitialValue="myData1"/>

        <Size> mySize </Size>
        <Loop>
          <Break Condition="iBucket > myNbBuckets"/>
          <If Condition="pData[iBucket] != nullptr">
            <Item> (DataMapNode*)pData[iBucket]</Item>
          </If>
          <Exec>iBucket = iBucket + 1</Exec>
        </Loop>
      </CustomListItems>
    </Expand>
  </Type>

  <Type Name="NCollection_DoubleMap&lt;*&gt;">
    <DisplayString>NCollection_DoubleMap [{mySize}]</DisplayString>
    <Expand>
      <CustomListItems MaxItemsPerView="120" ExcludeView="Test">
        <Variable Name="iBucket" InitialValue="0"/>
        <Variable Name="pData" InitialValue="myData1"/>

        <Size> mySize </Size>
        <Loop>
          <Break Condition="iBucket > myNbBuckets"/>
          <If Condition="pData[iBucket] != nullptr">
            <Item> (DoubleMapNode*)pData[iBucket]</Item>
          </If>
          <Exec>iBucket = iBucket + 1</Exec>
        </Loop>
      </CustomListItems>
    </Expand>
  </Type>

  <Type Name="NCollection_IndexedMap&lt;*&gt;">
    <DisplayString>NCollection_IndexedMap [{mySize}]</DisplayString>
    <Expand>
      <CustomListItems MaxItemsPerView="120" ExcludeView="Test">
        <Variable Name="iBucket" InitialValue="0"/>
        <Variable Name="pData" InitialValue="myData1"/>

        <Size> mySize </Size>
        <Loop>
          <Break Condition="iBucket > myNbBuckets"/>
          <If Condition="pData[iBucket] != nullptr">
            <Item> (IndexedMapNode*)pData[iBucket]</Item>
          </If>
          <Exec>iBucket = iBucket + 1</Exec>
        </Loop>
      </CustomListItems>
    </Expand>
  </Type>

  <Type Name="NCollection_IndexedDataMap&lt;*&gt;">
    <DisplayString>NCollection_IndexedDataMap [{mySize}]</DisplayString>
    <Expand>
      <CustomListItems MaxItemsPerView="120" ExcludeView="Test">
        <Variable Name="iBucket" InitialValue="0"/>
        <Variable Name="pData" InitialValue="myData1"/>

        <Size> mySize </Size>
        <Loop>
          <Break Condition="iBucket > myNbBuckets"/>
          <If Condition="pData[iBucket] != nullptr">
            <Item> (IndexedDataMapNode*)pData[iBucket]</Item>
          </If>
          <Exec>iBucket = iBucket + 1</Exec>
        </Loop>
      </CustomListItems>
    </Expand>
  </Type>

  <!-- Geom package -->

  <Type Name="Geom_CartesianPoint">
    <Expand>
      <Item Name="Name"> "Geom_CartesianPoint" </Item>
      <Item Name="RefCount"> count </Item>
      <ExpandedItem> gpPnt </ExpandedItem>
    </Expand>
  </Type>

  <Type Name="Geom_Line">
    <Expand>
      <Item Name="Name"> "Geom_Line" </Item>
      <Item Name="RefCount"> count </Item>
      <ExpandedItem> pos </ExpandedItem>
    </Expand>
  </Type>

  <Type Name="Geom_Circle">
    <Expand>
      <Item Name="Name"> "Geom_Circle" </Item>
      <Item Name="RefCount"> count </Item>
      <ExpandedItem> pos </ExpandedItem>
      <Item Name="Radius"> radius </Item>
    </Expand>
  </Type>

  <Type Name="Geom_Plane">
    <Expand>
      <Item Name="Type"> "Geom_Plane" </Item>
      <Item Name="RefCount"> count </Item>
      <ExpandedItem> pos </ExpandedItem>
    </Expand>
  </Type>

  <Type Name="Geom_CylindricalSurface">
    <Expand>
      <Item Name="Type"> "Geom_CylindricalSurface" </Item>
      <Item Name="RefCount"> count </Item>
      <ExpandedItem> pos </ExpandedItem>
      <Item Name="Radius"> radius </Item>
    </Expand>
  </Type>

  <!-- TopoDS package -->
  <Type Name="TopLoc_SListOfItemLocation">
    <DisplayString Condition="myNode.entity == 0x00000000"> nullptr </DisplayString>
  </Type>

  <Type Name="TopLoc_Location">
    <DisplayString Condition="myItems.myNode.entity == 0x00000000"> nullptr </DisplayString>
  </Type>

  <Type Name="TopoDS_Shape">
    <DisplayString>{myOrient} {myTShape} loc={myLocation}</DisplayString>
  </Type>

  <Type Name="TopoDS_TShape">
    <DisplayString>subshapes={myShapes} flags={myFlags}</DisplayString>
  </Type>

</AutoVisualizer>

特别注意

 

 标红部分需要加,否则不起作用

 

posted @ 2023-03-17 16:04  unicornsir  阅读(68)  评论(0编辑  收藏  举报