我正在为我为AutoCAD编程的插件创建一个.bundle文件夹.在文件夹的根目录是我的PackageContents.xml包,其中我的所有Lisp插件都是自动加载的.由于.dvb不是自动加载的支持类型,因此我使用以下代码自动加载了一个Lisp文件
(defun C:CSC ()
(vl-vbaload "WindowsDoors.dvb")
(vl-vbarun "WindowsDoors.dvb!CAD_STANDARD_CREATOR!CAD_STANDARD_BLOCK!CAD_STANDARD_PATH")
)
Run Code Online (Sandbox Code Playgroud)
代码运行并将我的插件,WindowsDoors.dvb放入AutoCAD但是当我尝试使用该插件时,命令行给了我以下内容
Command -vbarun
Initializing VBA System
Macro name: RunMeWindowDoor Execution error
Run Code Online (Sandbox Code Playgroud)
通常这会暗示代码中的错误,除非我在管理选项卡下使用AutoCAD 2014内置的应用程序加载器手动加载此插件时,它工作得很好,让我不知道出了什么问题.
我正在尝试编写两种调用AutoCAD的UNDO命令并传入不同参数的方法.第一种方法调用UNDO并传递M,这意味着标记绘图的位置.第二种方法调用UNDO并传递B,这意味着一直撤回到标记位置(如果没有,则返回结束).到目前为止,它们非常简单
/// <summary>
/// Method to mark the current position of the AutoCAD program
/// </summary>
public static void MarkPosition()
{
doc.SendStringToExecute("._UNDO M", true, false, true);
}
/// <summary>
/// Method to step AutoCAD back int steps
/// </summary>
public static void BigUndo()
{
doc.SendStringToExecute("._UNDO B", true, false, true);
}
Run Code Online (Sandbox Code Playgroud)
看起来他们应该工作,但由于某种原因,他们没有.当我调用MarkPosition()然后调用BigUndo()时,我得到一个错误,说遇到了Start of Group; 进入撤消结束以进一步返回.测试我的语法.我将MarkPosition改为
public static void MarkPosition()
{
doc.SendStringToExecute("circle 2,2,0 4 ", true, false, true);
}
Run Code Online (Sandbox Code Playgroud)
成功画了一个圆圈.这意味着我的语法是正确的,但撤消会发生一些奇怪的事情.
我正在尝试找到一种方法,可以将C#类作为XRecord存储到AutoCAD实体中.例如,我有以下类:
public class ExampleClass
{
private int x;
private int y;
public ExampleClass(int x, int y)
{
this.x = x;
this.y = y;
}
#region Getters and Setters
}
Run Code Online (Sandbox Code Playgroud)
我创建了一个它的实例:
ExampleClass objToStoreInXRecord = new ExampleClass(3, 5);
Run Code Online (Sandbox Code Playgroud)
将它存储到AutoCAD实体(例如图中的一行)XRecord的最佳方法是什么,这样我就可以这样做:
ExampleClass objRecoveredFromXRecord = GetXRecordFromEntity(Entity e)
Run Code Online (Sandbox Code Playgroud)
其中GetXRecordFromEntity(Entity e)是一个帮助器方法,我可以编写一个实体e,获取我之前存储的对象的XRecord,然后返回它.
我对XRecord的工作原理以及XRecord与AutoCAD的命名对象字典(NOD)的关系并没有很好的处理.我已经看到了实现,其中要存储在XRecord中的对象使用二进制格式化程序进行序列化,并且序列化数据存储在实体的XRecord中,但我正在寻找更好的方法.
我试图在运行时更改我的一个类中的变量的Browsable属性.包含该属性的类如下所示:
public class DisplayWallType : WallType
{
[TypeConverter(typeof(SheathingOptionsConverter))]
[Browsable(false)]
public override Sheathing SheathingType { get; set; }
public DisplayWallType(string passedName, string passedType, bool passedMirrorable, Distance passedHeight, string passedStudPattern, Distance passedStudSpacing, VaporBarrier passedBarrier)
: base(passedName, passedType, passedMirrorable, passedHeight, passedStudPattern, passedStudSpacing, passedBarrier)
{
}
/// <summary>
/// Empty constructor for XML serialization
/// </summary>
public DisplayWallType()
{
}
}
Run Code Online (Sandbox Code Playgroud)
我最初为SheathingType将其设置为false,因为我不希望该属性以我的应用程序的第一种形式显示.但是,我确实希望它在我的第二种形式中可见,所以我有这种方法来改变它
private void _makeSheathingVisible(DisplayWallType wallTypeToMakeSheathingVisible)
{
PropertyDescriptor descriptor = TypeDescriptor.GetProperties(wallTypeToMakeSheathingVisible.GetType())["SheathingType"];
BrowsableAttribute attrib = (BrowsableAttribute)descriptor.Attributes[typeof(BrowsableAttribute)];
FieldInfo isBrow = attrib.GetType().GetField("browsable", BindingFlags.NonPublic | BindingFlags.Instance);
isBrow.SetValue(attrib, true); …Run Code Online (Sandbox Code Playgroud) 我将使用PHP(https://developers.google.com/appengine/docs/php/gettingstarted/helloworld)浏览Google App Engine的helloworld教程.在设置好应用程序并准备好之后,教程告诉我使用以下命令启动Google App Engine SDK附带的Web服务器:google_appengine/dev_appserver.py --php_executable_path = helloworld /.我该如何启动Web服务器以及将该命令放在何处?
我正在尝试设置一个.bundle文件夹来加载我为AutoCAD设计的一系列插件.其中一个插件是.dvb文件,所以在PackageContents.xml中我有以下XML代码
<ComponentEntry AppName = "" Version = "2014.1" ModuleName = "./Contents/Windows/WindowsDoors.dvb" AppDescription = "" PerDocument ="True" LoadOnAutoCADStartup="True">
<Commands>
<Command Local="CSC" Global="CAD_STANDARD_CREATOR" />
<Command Local="CSB" Global="CAD_STANDARD_BLOCK" />
<Command Local="CSP" Global="CAD_STANDARD_PATH" />
</Commands>
</ComponentEntry>
Run Code Online (Sandbox Code Playgroud)
当我启动AutoCAD并尝试运行相应的插件时,命令行告诉我
Command: -vbarun
Macro name: RunMeWindowDoor
Macro not found.
Run Code Online (Sandbox Code Playgroud)
看来AutoCAD没有找到宏,即使我告诉XML文件加载它,我也无法弄清楚错误的原因是什么.
我试图让我的C#.NET插件在AutoCAD中绘制一个表格,其中包含基于用户填写的.NET表单的信息.我用来尝试此操作的代码基于此页面.根据我的计划修改它,代码如下所示:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Runtime;
namespace WindowsDoors.NET
{
class OpeningDataTable : Table
{
private int rowCount = 0;
private static Document doc = Application.DocumentManager.MdiActiveDocument; //Current drawing
private static Database db = doc.Database; //subclass of Document,
private static Editor ed = doc.Editor; //Editor object to ask user where table goes, subclass of Document
public OpeningDataTable(bool isWindow)
{
PromptPointResult pr = ed.GetPoint("\nEnter table insertion point: "); …Run Code Online (Sandbox Code Playgroud) 我正在尝试在正在开发的Web应用程序中实现基本的搜索页面。现在页面看起来像这样
当用户输入姓氏时,将调用控制器以在后端Microsoft SQL Server数据库中搜索具有该姓氏的所有帐户
现在,HTML表单如下所示
@using (Html.BeginForm("SearchAct", "HomeController", FormMethod.Post))
{
<form>
<div>
Last Name:<br>
<input type="text" id="nameToFind">
<input type="button" id="submitId" value="submit" />
</div>
</form>
}
Run Code Online (Sandbox Code Playgroud)
应该叫这个控制器
[HttpPost]
public void SearchAct()
{
Console.WriteLine();
}
Run Code Online (Sandbox Code Playgroud)
最终将执行搜索,然后将结果放在页面上。但是,我无法调用该控制器。我在WriteLine上设置了一个断点,所以我知道它永远不会到达那里,也不知道我在做什么错
我对使用C#的XML类比较陌生.我甚至无法让XML阅读器识别出我传递给它的字符串是XML.这是我用于测试基本Xml读数的单元测试
[TestFixture()]
public class LegacyWallTests
{
[Test()]
public void ReadLegacyWallFile()
{
var legacyWallText = legacyfiles.legacywall1;
{
string xmlString = legacyfiles.legacywall1;
using (XmlReader reader = XmlReader.Create(new StringReader(xmlString)))
{
reader.HasAttributes.Should().BeTrue();
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是我正在尝试阅读的XML
<Wall>
<Actual>
<Specifications>
<Insertion> 375.6858 916.8871 0.0000 </Insertion>
<Angle> 3.14159 </Angle>
<WallDesc> E4-1, H: 8' 1 1/8, Sh: Yes, S: 2~4~2~9-0-0~SPF~~, Spc: Single @ 16 in OC, BP: 2~4~2~12-0-0~SYP~~, CP: 2~4~2~12-0-0~SYP~~, TP: 2~4~2~12-0-0~SYP~~,\P LI: Single @ 38.75000000, CB: No, VB: No, NCT: 2~4~2~9-0-0~SPF~~, CT: 2~4~2~9-0-0~SPF~~, Pac: 2~4~2~9-0-0~SPF~~, …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 F# 的 List.map 函数来调用我在数组中的每个字符串上编写的函数。这是我写的函数
(*Takes a string and filters it down to common text characters*)
let filterWord wordToFilter =
Regex.Replace(wordToFilter, "[^a-zA-Z0-9/!\'?.-]", "");
Run Code Online (Sandbox Code Playgroud)
这是我称之为的主要方法
(*Main method of the program*)
[<EntryPoint>]
let main argsv =
let input = File.ReadAllText("Alice in Wonderland.txt"); //Reads all the text into a single string
let unfilteredWords = input.Split(' ');
let filteredWords = unfilteredWords |> List.map(fun x -> filterWord(x));
0;
Run Code Online (Sandbox Code Playgroud)
问题是我在 List.map 调用中遇到语法错误说
Error Type mismatch. Expecting a
string [] -> 'a
but given a
'b list …Run Code Online (Sandbox Code Playgroud)