乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 40|回复: 2

用JIG的时候出现没有为该对象定义无参数的构造函数

[复制链接]

4

主题

16

帖子

1

银币

初来乍到

Rank: 1

铜币
32
发表于 2014-4-20 19:27:00 | 显示全部楼层 |阅读模式

woonlwmi1n0.jpg

woonlwmi1n0.jpg



  1. using System;
  2. using System.Text;
  3. using System.Linq;
  4. using System.Xml;
  5. using System.Reflection;
  6. using System.ComponentModel;
  7. using System.Collections;
  8. using System.Collections.Generic;
  9. using System.Diagnostics;
  10. using System.Windows;
  11. using System.Windows.Media.Imaging;
  12. using System.Windows.Forms;
  13. using System.Drawing;
  14. using System.IO;
  15. using Autodesk..ApplicationServices;
  16. using Autodesk.AutoCAD.DatabaseServices;
  17. using Autodesk.AutoCAD.Runtime;
  18. using Autodesk.AutoCAD.EditorInput;
  19. using Autodesk.AutoCAD.Geometry;
  20. using Autodesk.AutoCAD.Windows;
  21. using Autodesk.AutoCAD.GraphicsInterface;
  22. using MgdAcApplication = Autodesk.AutoCAD.ApplicationServices.Application;
  23. using MgdAcDocument = Autodesk.AutoCAD.ApplicationServices.Document;
  24. using AcWindowsNS = Autodesk.AutoCAD.Windows;
  25. using DotNetARX;
  26. namespace SageDesign
  27. {
  28.     class DCBZJig:DrawJig
  29.     {
  30.         public AlignedDimension m_AlignedDimension;
  31.         private Point3d m_dimLinePoint;
  32.         public DCBZJig(AlignedDimension aliDim)
  33.         {
  34.             m_AlignedDimension = aliDim;
  35.         }
  36.         protected override bool WorldDraw(WorldDraw draw)
  37.         {
  38.             draw.Geometry.Draw(m_AlignedDimension);
  39.             return true;
  40.         }
  41.         protected override SamplerStatus Sampler(JigPrompts prompts)
  42.         {
  43.             Editor ed = MgdAcApplication.DocumentManager.MdiActiveDocument.Editor;
  44.             Matrix3d mt = ed.CurrentUserCoordinateSystem;
  45.             JigPromptPointOptions optJig = new JigPromptPointOptions
  46.                 ("\n请指定标注方向");
  47.             PromptPointResult resJigDis = prompts.AcquirePoint(optJig);
  48.             Point3d curPt = resJigDis.Value;
  49.             if (resJigDis.Status == PromptStatus.Cancel)
  50.             {
  51.                 return SamplerStatus.Cancel;
  52.             }
  53.             if (m_dimLinePoint != curPt)
  54.             {
  55.                 Line l1 = new Line(this.m_AlignedDimension.XLine1Point,this.m_AlignedDimension.XLine2Point);
  56.                 Point3d tempDimLinePt2 = l1.GetClosestPointTo(curPt, true);
  57.                 Vector3d vect = new Vector3d(curPt.X - tempDimLinePt2.X, curPt.Y - tempDimLinePt2.Y, curPt.Z - tempDimLinePt2.Z);
  58.                 Point3d dimLinePt = tempDimLinePt2.Add(vect.GetNormal() * 500);
  59.                 // 保存当前点.
  60.                 m_dimLinePoint = dimLinePt;
  61.                 return SamplerStatus.OK;
  62.             }
  63.             else
  64.             {
  65.                 return SamplerStatus.NoChange;
  66.             }
  67.         }
  68.         [CommandMethod("DCBZ")]
  69.         public void Dim()
  70.         {
  71.             Database db = HostApplicationServices.WorkingDatabase;
  72.             Editor ed = MgdAcApplication.DocumentManager.MdiActiveDocument.Editor;
  73.             PromptPointOptions pPtOpts = new PromptPointOptions("\n点取要标注的第一点:");
  74.             PromptPointResult pPtRes = ed.GetPoint(pPtOpts);
  75.             Point3d xLine1Point = pPtRes.Value;
  76.             if (pPtRes.Status == PromptStatus.OK)
  77.             {
  78.                 pPtOpts.Message = "第二点";
  79.                 pPtOpts.BasePoint = xLine1Point;
  80.                 pPtOpts.UseBasePoint = true;
  81.                 pPtRes = ed.GetPoint(pPtOpts);
  82.                 if (pPtRes.Status == PromptStatus.OK)
  83.                 {
  84.                     Point3d xLine2Point = pPtRes.Value;
  85.                     AlignedDimension aliDim = new AlignedDimension(xLine1Point,xLine2Point,xLine1Point,"",db.Dimstyle);
  86.                     DCBZJig dcbzjig = new DCBZJig(aliDim);
  87.                     PromptResult resJig = ed.Drag(dcbzjig);
  88.                     if (resJig.Status == PromptStatus.OK)
  89.                     {
  90.                         Tools.AddToModelSpace(db,dcbzjig.m_AlignedDimension);
  91.                     }
  92.                 }
  93.             }
  94.         }
  95.     }
  96. }

回复

使用道具 举报

32

主题

651

帖子

8

银币

中流砥柱

Rank: 25

铜币
779
发表于 2014-4-22 11:15:00 | 显示全部楼层
public DCBZJig()
{
}
--------------
加这个试试
回复

使用道具 举报

4

主题

16

帖子

1

银币

初来乍到

Rank: 1

铜币
32
发表于 2014-4-23 22:41:00 | 显示全部楼层

可以了
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-14 13:16 , Processed in 0.384704 second(s), 61 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表