www.mxdraw.com
内容索引主面
前一个向上下一个
MxDrawXCustomFunction::Mx_DrawHatchFromPoint 方法

由闭合区域内部一个点,绘制一个填充对象。

IDL
static LONG Mx_DrawHatchFromPoint(DOUBLE dX, DOUBLE dY, DOUBLE dPatternScale, McDbObjectIdArray filterIds);
参数 
说明 
DOUBLE dX 
点坐标X 点坐标Y 
DOUBLE dPatternScale 
填充图案缩放比例 
McDbObjectIdArray filterIds 
用来过滤的id数组 
ladOpt 
对填充内部的孤岛的处理.0 =忽略孤岛, 1 = 处理孤岛, 2 = 嵌套处理孤岛 

成功返回新绘制的填充对象id,失败返回0

例如: VB代码,点取闭合区域一点,填充。

            '《---------------------------------------》
            '绘制一个有图案的填充
            'angle, x-origin,y-origin, delta-x,delta-y,dash-1,dash-2, …
            '45 = angle 是图案线角度.
            '0 = x-origin 是第一个填充线经过的点位置X坐标
            '0 = y-origin 是第一个填充线经过的点位置Y坐标
            '0 = delta-x   是下一个填充线相对前一个线的X方向偏移
            '0.125 = delta-y   是下一个填充线相对前一个线的Y方向偏移
            MxDrawX1.AddPatternDefinition "MyHatchPattern1", "((45, 0,0, 0,0.125))"
            MxDrawX1.PatternDefinition = "MyHatchPattern1"


            Dim getPt8 As MxDrawXLib.MxDrawPoint


            Set mxUtility = New MxDrawXLib.MxDrawUtility

            Set getPt8 = mxUtility.GetPoint(, Chr(13) + Chr(10) + "拾取内部点:")

            If (getPt8 Is Nothing) Then
              Exit Sub
            End If


            Dim param8 As MxDrawXLib.MxDrawResbuf
            Set param8 = New MxDrawXLib.MxDrawResbuf
            param8.AddDouble getPt8.x, -10
            param8.AddDouble getPt8.y, -10
            '图案缩放比例
            param8.AddDouble 20#

            Dim ret8 As MxDrawXLib.MxDrawResbuf

            Set ret8 = MxDrawX1.CallEx("Mx_DrawHatchFromPoint", param8)

            If ret8.AtString(0) = "Ok" Then
                MsgBox ret8.AtLong(1)
            End If

例如: 选择指实体作为边界填充

        IMxDrawUiPrPointPtr getPt;
        getPt.CreateInstance(__uuidof( MxDrawXLib::MxDrawUiPrPoint ));

        IMxDrawUiPrPoint* pGetPt = getPt;
        pGetPt->put_message(_T("点取绘制点"));

        if(pGetPt->go() != mcOk)
        {
            return;
        }
        IMxDrawPointPtr pickPt = pGetPt->value();
        if(pickPt == NULL)
            return;

        IMxDrawSelectionSetPtr ss;
        ss.CreateInstance(__uuidof( MxDrawXLib::MxDrawSelectionSet ));

        ss->Select(mcSelectionSetUserSelect,NULL,NULL,NULL);

        IMxDrawResbufPtr param;
        param.CreateInstance(__uuidof( MxDrawXLib::MxDrawResbuf ));

        param->AddDouble(pickPt->x);
        param->AddDouble(pickPt->y);
        param->AddDouble(20.0);

        for(long i = 0; i < ss->Count;i++)
        {
            IMxDrawEntityPtr ent = ss->Item(i);
            if(ent == NULL)
                continue;

            param->AddObjectId(ent->ObjectID);
        }

        IDispatchPtr spRet(m_ocx.CallEx(_T("Mx_DrawHatchFromPoint"),param),false);
Copyright (c) 2010. All rights reserved.
你认为该帮助怎么样? 发送反馈信息!