天气与日历 切换到窄版

 找回密码
 立即注册
中国膜结构网
十大进口膜材评选 十大国产膜材评选 十大膜结构设计评选 十大膜结构公司评选
查看: 28|回复: 0

AcEdInputPointMonitor 反应器,用来重载CAD鼠标点处实体的提示信息

[复制链接]
  • TA的每日心情
    开心
    昨天 06:36
  • 签到天数: 15 天

    [LV.4]偶尔看看III

    105

    主题

    11

    回帖

    1308

    积分

    管理员

    积分
    1308
    QQ
    发表于 2024-9-25 13:30:22 | 显示全部楼层 |阅读模式
    1. <pre name="code" class="cpp"><pre name="code" class="cpp">//   Copyright (C) 1998-2007 by Autodesk, Inc.
    2. //
    3. //     Permission to use, copy, modify, and distribute this software
    4. //     for any purpose is restricted by the VIP Subscription program
    5. //     license agreement.  This application was developed exclusively
    6. //     for distribution by the VIP subscription program and may not
    7. //     be posted pubicly, modified, copied, or distributed by any other
    8. //     methods.
    9. //
    10. //     AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.  
    11. //     AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
    12. //     MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
    13. //     DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
    14. //     UNINTERRUPTED OR ERROR FREE.
    15. //
    16. //     Use, duplication, or disclosure by the U.S. Government is subject to
    17. //     restrictions set forth in FAR 52.227-19 (Commercial Computer
    18. //     Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
    19. //     (Rights in Technical Data and Computer Software), as applicable.
    20. //

    21. #include "acedinpt.h"

    22. class AsdkInputPointMonitor : public AcEdInputPointMonitor
    23. {
    24. public:
    25.     virtual Acad::ErrorStatus monitorInputPoint(const AcEdInputPoint& input, AcEdInputPointMonitorResult& output);
    26.     virtual bool excludeFromOsnapCalculation (const AcArray<AcDbObjectId>& nestedEntity, INT_PTR gsSelectionMark);
    27. };
    复制代码

    1. //   Copyright (C) 1998-2007 by Autodesk, Inc.
    2. //
    3. //     Permission to use, copy, modify, and distribute this software
    4. //     for any purpose is restricted by the VIP Subscription program
    5. //     license agreement.  This application was developed exclusively
    6. //     for distribution by the VIP subscription program and may not
    7. //     be posted pubicly, modified, copied, or distributed by any other
    8. //     methods.
    9. //
    10. //     AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.  
    11. //     AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
    12. //     MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
    13. //     DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
    14. //     UNINTERRUPTED OR ERROR FREE.
    15. //
    16. //     Use, duplication, or disclosure by the U.S. Government is subject to
    17. //     restrictions set forth in FAR 52.227-19 (Commercial Computer
    18. //     Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
    19. //     (Rights in Technical Data and Computer Software), as applicable.
    20. //

    21. // AsdkInputPointMonitor methods
    22. //

    23. #if defined(_DEBUG) && !defined(AC_FULL_DEBUG)
    24. #error _DEBUG should not be defined except in internal Adesk debug builds
    25. #endif

    26. #include "acdbabb.h"
    27. #include "adeskabb.h"
    28. #include "aced.h"
    29. #include "dbents.h"
    30. #include "dbosnap.h"
    31. #include "tchar.h"

    32. #include "monitor.h"


    33. Acad::ErrorStatus
    34. AsdkInputPointMonitor::monitorInputPoint(const AcEdInputPoint& input, AcEdInputPointMonitorResult& output)
    35. {
    36.     if ( !input.pointComputed() )
    37.     {
    38.         // Points cannot be computed in the Monitor
    39.         // Forced picking may be enabled

    40.         if ( input.history() & Acad::eCyclingPt)
    41.             acutPrintf( _T("\nNo point computed, but new cycling osnap: %.2f, %.2f, %.2f\n"),
    42.                 input.osnappedPoint()[X], input.osnappedPoint()[Y], input.osnappedPoint()[Z] );

    43.         return Acad::eOk;
    44.     }

    45.     // Show historical point selection information
    46.     //
    47. #define HISTORY_CHECK(x)  if (input.history() & Acad:: ## x) acutPrintf(_T("%s "), _T(#x))

    48.     acutPrintf( _T("\nHistory: %d, "), input.history() );

    49.     HISTORY_CHECK(eTablet);
    50.     HISTORY_CHECK(eNotDigitizer);
    51.     HISTORY_CHECK(eLastPt);
    52.     HISTORY_CHECK(eGripped);
    53.     HISTORY_CHECK(eCartSnapped);
    54.     HISTORY_CHECK(eOrtho);
    55.     HISTORY_CHECK(eCyclingPt);
    56.     HISTORY_CHECK(eOsnapped);
    57.     HISTORY_CHECK(ePolarAngle);
    58.     HISTORY_CHECK(eAligned);
    59.     HISTORY_CHECK(eAppFiltered);
    60.     HISTORY_CHECK(eForcedPick);
    61.     HISTORY_CHECK(ePickMask);
    62.     HISTORY_CHECK(eDidNotPick);
    63.     HISTORY_CHECK(eUsedPickBox);
    64.     HISTORY_CHECK(eUsedOsnapBox);
    65.     HISTORY_CHECK(ePickAborted);
    66.     HISTORY_CHECK(eXPending);
    67.     HISTORY_CHECK(eYPending);
    68.     HISTORY_CHECK(eZPending);
    69.     HISTORY_CHECK(eCoordPending);

    70. #undef HISTORY_CHECK

    71.     acutPrintf( _T("\n") );

    72.     // Show more point input information
    73.     //
    74.     if ( input.history() & Acad::eLastPt )
    75.         acutPrintf( _T("Last point:              %.2f, %.2f, %.2f\n"), input.lastPoint()[X], input.lastPoint()[Y], input.lastPoint()[Z] );

    76.     acutPrintf( _T("Raw point:               %.2f, %.2f, %.2f\n"), input.rawPoint()[X], input.rawPoint()[Y], input.rawPoint()[Z] );
    77.     acutPrintf( _T("Computed point:          %.2f, %.2f, %.2f\n"), input.computedPoint()[X], input.computedPoint()[Y], input.computedPoint()[Z] );

    78.     if ( input.history() & Acad::eGripped )
    79.         acutPrintf( _T("Gripped point:           %.2f, %.2f, %.2f\n"), input.grippedPoint()[X], input.grippedPoint()[Y], input.grippedPoint()[Z] );
    80.         
    81.     if ( input.history() & Acad::eCartSnapped )
    82.         acutPrintf( _T("Cartesian snapped point: %.2f, %.2f, %.2f\n"), input.cartesianSnappedPoint()[X], input.cartesianSnappedPoint()[Y], input.cartesianSnappedPoint()[Z] );

    83.     if ( input.history() & Acad::eOsnapped )
    84.     {
    85.         acutPrintf( _T("Osnapped point:          %.2f, %.2f, %.2f\n"), input.osnappedPoint()[X], input.osnappedPoint()[Y], input.osnappedPoint()[Z] );

    86.         acutPrintf( _T("Object snap masks: ") );

    87. #define OSMASK_CHECK(x)  if (input.osnapMask() & AcDb:: ## x) acutPrintf(_T("%s "), _T(#x))

    88.         OSMASK_CHECK(kOsMaskEnd);
    89.         OSMASK_CHECK(kOsMaskMid);
    90.         OSMASK_CHECK(kOsMaskCen);
    91.         OSMASK_CHECK(kOsMaskNode);
    92.         OSMASK_CHECK(kOsMaskQuad);
    93.         OSMASK_CHECK(kOsMaskInt);
    94.         OSMASK_CHECK(kOsMaskIns);
    95.         OSMASK_CHECK(kOsMaskPerp);
    96.         OSMASK_CHECK(kOsMaskTan);
    97.         OSMASK_CHECK(kOsMaskNear);
    98.         OSMASK_CHECK(kOsMaskQuick);
    99.         OSMASK_CHECK(kOsMaskApint);
    100.         OSMASK_CHECK(kOsMaskImmediate);
    101.         OSMASK_CHECK(kOsMaskAllowTan);
    102.         OSMASK_CHECK(kOsMaskDisablePerp);
    103.         OSMASK_CHECK(kOsMaskRelCartesian);
    104.         OSMASK_CHECK(kOsMaskRelPolar);

    105. #undef OSMASK_CHECK

    106.         if ( 0 == input.osnapMask() )
    107.         {
    108.             for ( int i = 0; i < input.customOsnapModes().length(); i++ )
    109.                 acutPrintf( _T("%s\n"), input.customOsnapModes()[i]->globalModeString() );
    110.         }
    111.         acutPrintf( _T("\n") );
    112.     }

    113.     // Show the object snap overrides
    114.     //
    115.     if ( 0 != input.osnapOverrides() )
    116.     {

    117.         acutPrintf( _T("Object snap overrides: ") );

    118. #define OSMASK_CHECK(x)  if (input.osnapOverrides() & AcDb:: ## x) acutPrintf(_T("%s "), _T(#x))

    119.         OSMASK_CHECK(kOsMaskEnd);
    120.         OSMASK_CHECK(kOsMaskMid);
    121.         OSMASK_CHECK(kOsMaskCen);
    122.         OSMASK_CHECK(kOsMaskNode);
    123.         OSMASK_CHECK(kOsMaskQuad);
    124.         OSMASK_CHECK(kOsMaskInt);
    125.         OSMASK_CHECK(kOsMaskIns);
    126.         OSMASK_CHECK(kOsMaskPerp);
    127.         OSMASK_CHECK(kOsMaskTan);
    128.         OSMASK_CHECK(kOsMaskNear);
    129.         OSMASK_CHECK(kOsMaskQuick);
    130.         OSMASK_CHECK(kOsMaskApint);
    131.         OSMASK_CHECK(kOsMaskImmediate);
    132.         OSMASK_CHECK(kOsMaskAllowTan);
    133.         OSMASK_CHECK(kOsMaskDisablePerp);
    134.         OSMASK_CHECK(kOsMaskRelCartesian);
    135.         OSMASK_CHECK(kOsMaskRelPolar);

    136. #undef OSMASK_CHECK

    137.         acutPrintf(_T("\n"));
    138.     }

    139.     // Show custom object snap overrides
    140.     //
    141.     if ( 0 != input.customOsnapOverrides().length() )
    142.     {
    143.         acutPrintf( _T("Custom object snap overrides: ") );
    144.         for ( int x = 0; x < input.customOsnapOverrides().length(); x++)
    145.             acutPrintf( _T("%s "), input.customOsnapOverrides()[x]->globalModeString() );
    146.         acutPrintf( _T("\n") );
    147.     }

    148.     // Show object snap or forced pick information: the entities in the aperture
    149.     acutPrintf( _T("%d apertured entities, "), input.pickedEntities().length() );
    150.     acutPrintf( _T("%d nested apertured entities\n"), input.nestedPickedEntities().length() );

    151.     // Show AutoSnap information
    152.     // Note: nestedKeyPointEntities.length() == keyPointGsSelectionMark.length()
    153.     //
    154.     acutPrintf( _T("%d key point entities, "), input.keyPointEntities().length() );
    155.     acutPrintf( _T("%d nested key point entities\n"), input.nestedKeyPointEntities().length() );
    156.     acutPrintf( _T("%d alignment paths\n"), input.alignmentPaths().length() );

    157.     // Add an additional comment to the tootip string
    158.     //
    159.     if ( NULL != input.tooltipString() )
    160.     {
    161.         output.setAdditionalTooltipString(_T(", Additional comment!"));
    162.         acutPrintf( _T("Appending "%s" to "%s"\n"), _T(", Additional comment!"), input.tooltipString() );
    163.     }
    164.     else
    165.         acutPrintf( _T("Tooltip is NULL\n") );

    166.     acedPostCommandPrompt();
    167.     return Acad::eOk;
    168. }

    169. bool
    170. AsdkInputPointMonitor::excludeFromOsnapCalculation (const AcArray<AcDbObjectId>& nestedEntity, INT_PTR gsSelectionMark)
    171. {
    172.     acutPrintf( _T("\nExcludeFromOsnapCalculation called on monitor...\n") );
    173.     acutPrintf( _T("%d nested entities under cursor\n"), nestedEntity.length() );
    174.     return false;
    175. }
    复制代码

     

     

     

     

    AcEdInputPointMonitor 反应器,用来重载CAD鼠标点处实体的提示信息
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|Archiver|中国膜结构网|中国膜结构协会|进口膜材|国产膜材|ETFE|PVDF|PTFE|设计|施工|安装|车棚|看台|污水池|中国膜结构网_中国空间膜结构协会

    GMT+8, 2024-11-1 10:35 , Processed in 0.127896 second(s), 24 queries .

    Powered by Discuz! X3.5

    © 2001-2024 Discuz! Team.

    快速回复 返回顶部 返回列表