C# Class Revit.SDK.Samples.CurtainWallGrid.CS.GridDrawing

Maintain the appearance of the 2D projection of the curtain grid and its behaviors
ファイルを表示 Open project: AMEE/revit Class Usage Examples

Public Methods

Method Description
AddDashLine ( System mousePosition ) : void

add the dash U/V line (used only in "Move grid line" operation)

AddDashULine ( System mousePosition ) : bool

show the candicate new U grid line to be added. In "add horizontal grid line" operation, there'll be a dash line following the movement of the mouse, it's drawn by this method

AddDashVLine ( System mousePosition ) : bool

show the candicate new V grid line to be added. In "add vertical grid line" operation, there'll be a dash line following the movement of the mouse, it's drawn by this method

DrawCurtainGrid ( Graphics graphics ) : void

draw curtain grid in the canvas

GetConjointSegments ( SegmentLine2D segLine, List removeSegments ) : void

check whether the segments which have the same junction with the specified segment will be isolated if we delete the specified segment for example: 2 grid line has one junction, so there'll be 4 segments connecting to this junction let's delete 2 segments out of the 4 first, then if we want to delete the 3rd segment, the 4th segment will be a "isolated" one, so we will pick this kind of segment out

GetLines2D ( ) : void

get the 2D data of the curtain grid the original data is in CurtainGridLine/XYZ/Curve format of Revit, change it to Point/GridLine2D format

GridDrawing ( MyDocument myDoc, GridGeometry geometry ) : System

constructor

SelectLine ( System mousePosition, bool verifyLock, bool verifyRemove ) : void

pick up a grid line by mouse

SelectSegment ( System mousePosition ) : void

pick up a segment

SelectULine ( System mousePosition, bool verifyLock, bool verifyRemove ) : void

pick up a U grid line by mouse

SelectUSegment ( System mousePosition ) : void

pick up a segment of a U grid line

SelectVLine ( System mousePosition, bool verifyLock, bool verifyRemove ) : void

pick up a V grid line by mouse

SelectVSegment ( System mousePosition ) : void

pick up a segment of a V grid line

Private Methods

Method Description
ConvertCurveToSegment ( CurveArray curveArray ) : List

convert the segment lines in Curve format to SegmentLine2D format

ConvertToLine2D ( CurtainGridLine line, List segPaths, int gridLineIndex ) : GridLine2D

convert the grid line in CurtainGridLine format to GridLine2D format in the Canvas area, the "System.Drawing.Point" instances are directly used, it's hard for us to use CurtainGridLine and Autodesk.Revit.DB.XYZ directly, so convert them to 2D data first

DrawAssistLine ( Graphics graphics ) : void

draw the assistant lines used to highlight some special lines for example: in add Horizontal/Vertical grid line operations, the to-be-added lines will be shown in bold with red color, this assistant line is drawn in this method

DrawBoundLines ( Graphics graphics, Pen pen ) : void

draw the boundary lines of the curtain grid

DrawULines ( Graphics graphics, Pen lockPen, Pen unlockPen ) : void

draw the U grid lines

DrawVLines ( Graphics graphics, Pen lockPen, Pen unlockPen ) : void

draw the V grid lines

GetBoundLines2D ( ) : void

get the boundary lines of the curtain grid

GetConjointSegment ( System point, bool isUSegment, SegmentLine2D &removeSegLine ) : void

get all the segments which is connected to the end point of the segment and is in the same line as the segment for example: 2 grid line has one junction, so there'll be 4 segments connecting to this junction 2 U segments and 2 V segments, delete the 2 U segments first, then delete one of the V segment, the other V segment will be marked as the "ConjointSegment" and will be deleted automatically. this method is used to pick the "the other V segment" out

GetOutlineIndex ( List pathList, System point ) : int

get which grid line (in GraphicsPath format) contains the specified point, if the grid line contains the point, return the index of the grid line

GetOutlineIndexes ( List segList, System point ) : List

get which segment contains the specified point, if the segment contains the point, return the index of the segment in the grid line

GetSegments ( GridLine2D gridLine2D, CurveArray allCurves, List skippedSegments, List segPaths, int gridLineIndex ) : void

get all the segments of the specified grid line

GetULines2D ( ) : void

get the U ("Horizontal") grid lines and their segments in GridLine2D format

GetVLines2D ( ) : void

get the V ("Vertical") grid lines and their segments in GridLine2D format

IsOverlapped ( System point, List paths ) : bool

check whether the point is in the outline of the paths

IsPointIsolate ( System point ) : bool

check whether the segments which have the same junction with the specified junction will be isolated if we delete the specified segment for example: 2 grid line has one junction, so there'll be 4 segments connecting to this junction let's delete 2 segments out of the 4 first, then if we want to delete the 3rd segment, the 4th segment will be a "isolated" one, so we will pick this kind of segment out

IsPointsEqual ( System pa, System pb ) : bool

judge whether the 2 points are equal (have the same coordinate) (as the X & Y of the Point class are both int values, so needn't use AlmostEqual)

IsSegLineContained ( List lines, SegmentLine2D lineB ) : bool

identify whether the segment is contained in the segments of a grid line

UpdateIsolate ( ) : void
VerifyMouseLocation ( System mousePosition ) : bool

if mouse insiede the curtain grid area, returns true; otherwise false

Method Details

AddDashLine() public method

add the dash U/V line (used only in "Move grid line" operation)
public AddDashLine ( System mousePosition ) : void
mousePosition System /// the location of the mouse cursor ///
return void

AddDashULine() public method

show the candicate new U grid line to be added. In "add horizontal grid line" operation, there'll be a dash line following the movement of the mouse, it's drawn by this method
public AddDashULine ( System mousePosition ) : bool
mousePosition System /// the location of the mouse cursor ///
return bool

AddDashVLine() public method

show the candicate new V grid line to be added. In "add vertical grid line" operation, there'll be a dash line following the movement of the mouse, it's drawn by this method
public AddDashVLine ( System mousePosition ) : bool
mousePosition System /// the location of the mouse cursor ///
return bool

DrawCurtainGrid() public method

draw curtain grid in the canvas
public DrawCurtainGrid ( Graphics graphics ) : void
graphics System.Drawing.Graphics /// form graphic ///
return void

GetConjointSegments() public method

check whether the segments which have the same junction with the specified segment will be isolated if we delete the specified segment for example: 2 grid line has one junction, so there'll be 4 segments connecting to this junction let's delete 2 segments out of the 4 first, then if we want to delete the 3rd segment, the 4th segment will be a "isolated" one, so we will pick this kind of segment out
public GetConjointSegments ( SegmentLine2D segLine, List removeSegments ) : void
segLine SegmentLine2D /// the specified segment used to checking ///
removeSegments List /// the result seg list (all the segments in this list is to-be-deleted) ///
return void

GetLines2D() public method

get the 2D data of the curtain grid the original data is in CurtainGridLine/XYZ/Curve format of Revit, change it to Point/GridLine2D format
public GetLines2D ( ) : void
return void

GridDrawing() public method

constructor
public GridDrawing ( MyDocument myDoc, GridGeometry geometry ) : System
myDoc MyDocument
geometry GridGeometry /// the referred parent geometry of the curtain grid ///
return System

SelectLine() public method

pick up a grid line by mouse
public SelectLine ( System mousePosition, bool verifyLock, bool verifyRemove ) : void
mousePosition System /// the location of the mouse cursor ///
verifyLock bool /// will locked grid lines be picked (if verifyLock is true, won't pick up locked ones) ///
verifyRemove bool /// whether grid line without skipped segments be picked (if verifyRemove is true, won't pick up the grid line without skipped segments) ///
return void

SelectSegment() public method

pick up a segment
public SelectSegment ( System mousePosition ) : void
mousePosition System /// the location of the mouse cursor ///
return void

SelectULine() public method

pick up a U grid line by mouse
public SelectULine ( System mousePosition, bool verifyLock, bool verifyRemove ) : void
mousePosition System /// the location of the mouse cursor ///
verifyLock bool /// will locked grid lines be picked (if verifyLock is true, won't pick up locked ones) ///
verifyRemove bool /// whether grid line without skipped segments be picked (if verifyRemove is true, won't pick up the grid line without skipped segments) ///
return void

SelectUSegment() public method

pick up a segment of a U grid line
public SelectUSegment ( System mousePosition ) : void
mousePosition System /// the location of the mouse cursor ///
return void

SelectVLine() public method

pick up a V grid line by mouse
public SelectVLine ( System mousePosition, bool verifyLock, bool verifyRemove ) : void
mousePosition System /// the location of the mouse cursor ///
verifyLock bool /// will locked grid lines be picked (if verifyLock is true, won't pick up locked ones) ///
verifyRemove bool /// whether grid line without skipped segments be picked (if verifyRemove is true, won't pick up the grid line without skipped segments) ///
return void

SelectVSegment() public method

pick up a segment of a V grid line
public SelectVSegment ( System mousePosition ) : void
mousePosition System /// the location of the mouse cursor ///
return void