码迷,mamicode.com
首页 > 其他好文 > 详细

一些浩辰设置及它的bug?

时间:2019-01-02 19:21:41      阅读:228      评论:0      收藏:0      [点我收藏+]

标签:ota   res   gets   and   table   就会   div   option   family   

  1. gcad执行快捷键有问题?
    尝试修改Setvar("autocompletemode", "19");原因是’输入按键时显示建议列表’这个项打钩了,这里首先捕捉的是lisp定义的命令,而不是pgp.
  2. 设置了系统变量:Dynmode,0动态输入,这个参数将导致zoom缩放的时候,鼠标会发生跳动,并有一定几率停留在边界.
    一定要多用zoom测试,即使不设置这个参数也是有一点几率发生鼠标跳动,只是设置了更容易看见这个问题,并且会产生停留.
    技术分享图片

  3. gcad的net的选择集参数有误.
         //定义选择集选项
    
          PromptSelectionOptions pso = new PromptSelectionOptions
    
          { 
    
           // SingleOnly = true,                   //不需要空格确认,但是浩辰会变成鼠标单框
    
              SelectEverythingInAperture = true,   //鼠标单框
    
          };
    技术分享图片
    #if !HC2019
    using Autodesk.AutoCAD.ApplicationServices;
    using Autodesk.AutoCAD.DatabaseServices;
    using Autodesk.AutoCAD.DatabaseServices.Filters;
    using Autodesk.AutoCAD.EditorInput;
    using Autodesk.AutoCAD.Geometry;
    using Autodesk.AutoCAD.Runtime;
    using Autodesk.AutoCAD.Colors;
    using Autodesk.AutoCAD.GraphicsInterface;
    #else
    using GrxCAD.DatabaseServices;
    using GrxCAD.EditorInput;
    using GrxCAD.Geometry;
    using GrxCAD.ApplicationServices;
    using GrxCAD.Runtime;
    using GrxCAD.Colors;
    using GrxCAD.GraphicsInterface;
    #endif
    using System.Collections.Generic;
    using System.Linq;
    
    namespace JJBoxGstarCad_2019
    {
        public static class Test
        {
            //请先先用gcad测试test1和test2,可以看到两段代码的作用是一样的.
            //然后再用acad测试test1和test2,可以看到test2中的SingleOnly的作用.
         
            // SingleOnly = true的作用应该是"选择了图元后不需要空格确认"立马成为一个选择集,而不是成为一个鼠标单选框.
            // SelectEverythingInAperture = true,为鼠标单框.
             
            [CommandMethod("test1", CommandFlags.Modal | CommandFlags.UsePickSet)]
            public static void Test1()
            {
                Database db = HostApplicationServices.WorkingDatabase;//当前的数据库
                DocumentCollection doc = Application.DocumentManager;
                Editor ed = doc.MdiActiveDocument.Editor;
               
                //定义选择集选项
                PromptSelectionOptions pso = new PromptSelectionOptions
                {
                    AllowDuplicates = false,  //重复选择
                   // SingleOnly = true,        //不需要空格确认,但是浩辰会变成单选
                    SelectEverythingInAperture = true,   //鼠标单框
                };  
                var ssPsr = ed.GetSelection(pso);
                if (ssPsr.Status != PromptStatus.OK) return;
                using (Transaction tr = db.TransactionManager.StartTransaction())
                {
                    foreach (var id in ssPsr.Value.GetObjectIds())//遍历选择集亮显测试用
                    {
                        var ent = (Entity)id.GetObject(OpenMode.ForRead);
                        ent.Highlight();
                    } 
                    tr.Commit();
                } 
            }
    
            [CommandMethod("test2", CommandFlags.Modal | CommandFlags.UsePickSet)]
            public static void Test2()
            {
                Database db = HostApplicationServices.WorkingDatabase;//当前的数据库
                DocumentCollection doc = Application.DocumentManager;
                Editor ed = doc.MdiActiveDocument.Editor;
     
                //定义选择集选项
                PromptSelectionOptions pso = new PromptSelectionOptions
                {
                    AllowDuplicates = false,  //重复选择
                    SingleOnly = true,        //不需要空格确认,但是浩辰会变成单选
                   // SelectEverythingInAperture = true,   //鼠标单框
                };
                var ssPsr = ed.GetSelection(pso);
                if (ssPsr.Status != PromptStatus.OK) return; 
                using (Transaction tr = db.TransactionManager.StartTransaction())
                {
                    foreach (var id in ssPsr.Value.GetObjectIds())//遍历选择集亮显测试用
                    {
                        var ent = (Entity)id.GetObject(OpenMode.ForRead);
                        ent.Highlight();
                    }
                    tr.Commit();
                }
            } 
        }
    }
    View Code

     

  4. gcad的net的组块问题,这里将导致图元出现不可选择的问题..
    技术分享图片
    #if !HC2019
    using Autodesk.AutoCAD.ApplicationServices;
    using Autodesk.AutoCAD.DatabaseServices;
    using Autodesk.AutoCAD.DatabaseServices.Filters;
    using Autodesk.AutoCAD.EditorInput;
    using Autodesk.AutoCAD.Geometry;
    using Autodesk.AutoCAD.Runtime;
    #else
    using GrxCAD.DatabaseServices;
    using GrxCAD.EditorInput;
    using GrxCAD.Geometry;
    using GrxCAD.ApplicationServices;
    using GrxCAD.Runtime;
    #endif
    using System;
    using static JingJingBoxDD.CadSystem;
    
    
    
    public class Command_jjline
    {
        [CommandMethod("LL", CommandFlags.Modal | CommandFlags.DocExclusiveLock)]
        public static void LL()
        {
            Database db = HostApplicationServices.WorkingDatabase;//当前的数据库
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
    
            try
            {
                PromptPointOptions ppo1 = new PromptPointOptions("\n指定第一点:");
                PromptPointResult ppr1 = ed.GetPoint(ppo1);//用户点选             
                if (ppr1.Status != PromptStatus.OK)
                {
                    return;
                }
    
                PromptPointOptions ppo2 = new PromptPointOptions("\n指定另一点:")
                {
                    UseBasePoint = true,
                    BasePoint = ppr1.Value
                };
                PromptPointResult ppr2 = ed.GetPoint(ppo2);//用户点选             
                if (ppr2.Status != PromptStatus.OK)
                {
                    return;
                }
    
                //生成xline
                using (Transaction tr = db.TransactionManager.StartTransaction())
                {
                    //块表
                    BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForWrite);
                    Line line = new Line
                    {
                        StartPoint = ppr1.Value,
                        EndPoint = ppr2.Value,
                    };
                    //添加一个新的块表记录,这个记录将存放块参照的所有图元
                    BlockTableRecord btrNew = new BlockTableRecord { Name = "test", Origin = line.StartPoint };
                    btrNew.AppendEntity(line);
                    bt.Add(btrNew);
                    tr.AddNewlyCreatedDBObject(btrNew, true);//添加新创建的数据库对象  
    
    
                    //新建块参照加入到当前空间
                    BlockReference br = new BlockReference(line.StartPoint, btrNew.ObjectId)
                    {
                        ScaleFactors = new Scale3d()
                    };
    
                    //当前空间的块表记录
                    BlockTableRecord btrCu = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
                    var brId = btrCu.AppendEntity(br);  //加入块表记录
    
                    //※※※※※※※※※※※※※※※※※   tr.AddNewlyCreatedDBObject(br, true);    //这句如果在变形之后,将导致浩辰不可以选择块
    
                    //计算变换矩阵 
                    Matrix3d mt = Matrix3d.Rotation(Math.PI, Vector3d.ZAxis, line.StartPoint);
                    Entity ent = (Entity)brId.GetObject(OpenMode.ForWrite);
                    ent.TransformBy(mt);
    
                    tr.AddNewlyCreatedDBObject(br, true);    //这句如果在变形之后,将导致浩辰不可以选择块
    
                    btrCu.DowngradeOpen();
                    br.DowngradeOpen();
                    tr.Commit();
                }
            }
            catch (System.Exception e)
            {
                ed.WriteMessage(e.Message);
                throw e;
            }
        }
    }
    View Code

     

  5. acad允许但是浩辰不允许,新建文字样式的时候如果用到.TTF字体,直接写字体名称就好了,不能够写"新宋体.TTF"不然就会出错,而acad想怎么写都可以.否则出现以下情况:
    技术分享图片技术分享图片
    看上去是乱码的一坨东西,而文字样式面板的字体名多了个(X)...

一些浩辰设置及它的bug?

标签:ota   res   gets   and   table   就会   div   option   family   

原文地址:https://www.cnblogs.com/JJBox/p/10209703.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!