autocad

ObjectARX SDK for c#

倖福魔咒の 提交于 2019-12-11 19:25:04
问题 For last two days I have looking for sample code with steps which may help me to understand the Autocad API. so I can use the code in C#. [CommandMethod("LISTGEn")] public static void ListEntities() { Document acDoc = Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument; Database acCurDb = acDoc.Database; using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction()) { // Open the Block table record for read BlockTable acBlkTbl; acBlkTbl =

nonsense argument exception calling method

那年仲夏 提交于 2019-12-11 13:49:27
问题 I'm receiving an ArgumentException "Object type cannot be converted to target type" but it doesn't make very sense to me. the method I'm calling has the following signature: public void Scan(IProgressStatus monitor, string registryPath, string startupDir, string addinsDir, string databaseDir, string scanFolder, string[] filesToIgnore) I tried to pass monitor instead of remMonitor but the exception is still thrown. All the arguments have values except scanFolder that is null (but passing

autocad 2010 doesn't support VB developed plug-in

此生再无相见时 提交于 2019-12-11 12:40:56
问题 I have encountered a problem. My company bought a VB developed plug-in,which allows us to print the dwg files to a shared printer.This plug-in works fine with version 2009 and before. Instead of tapping 'plot' in command window, we tap 'eplot' ,the plug-in would then connect to the remote printer,upload,print and back up the dwg files. But after we upgraded to 2010,the problem arose. The 'eplot' command wasn't being recognized by 2010. I had heard that 2010 doesn't support VBA applications,

c# RuntimeBinderException when using dynamic variable to handle internal types. How can I fix that?

南笙酒味 提交于 2019-12-11 10:21:39
问题 I'm using a not-fully-exposed API in the add-on that I'm currently writing. Some classes there are still kept internal, although some public methods require parameters of these types. To handle the problem I tried to use dynamic typing with a helper DymamicObject implementation. I was pretty successful doing so but at one point I get a RuntimeBinderException, which doesn't tell me the exact details: "The best overloaded method match for Autodesk.Civil.DatabaseServices.PressurePipeNetwork

Exception: Invalid object array with comtypes

不羁岁月 提交于 2019-12-11 05:46:46
问题 I try to implement a simple copy operation between two Autocad documents via COM in Python. from pyautocad import Autocad, APoint from comtypes.client import GetBestInterface # Get acad application acad = Autocad(create_if_not_exists=True) # Create a new document doc1 = GetBestInterface(acad.Application.Documents.Add()) # add a circle in this document and make it visible circle = GetBestInterface(doc1.ModelSpace.AddCircle(APoint(0.0, 0.0), 1.0)) doc1.Application.ZoomExtents() # create another

How to translate this AutoCAD VBA code into Python?

会有一股神秘感。 提交于 2019-12-11 05:33:47
问题 I'm trying to automate some drawing in AutoCAD using Python and I work with SelectOnScreen method. Here is a code in VBA: Dim FilterType(0) As Integer Dim FilterData(0) As Variant FilterType(0) = 0 FilterData(0) = "TEXT" selection.SelectOnScreen FilterType, FilterData In Python I use it as: FilterType = win32com.client.VARIANT(VT_ARRAY|VT_I2, [0]) FilterData = win32com.client.VARIANT(VT_ARRAY|VT_VARIANT, ['TEXT']) selection.SelectOnScreen(FilterType, FilterData) and it works in AutoCAD.

drawing line close to polyline

瘦欲@ 提交于 2019-12-11 04:05:52
问题 I have a Triangle as a polyline and I want to draw an Altitude. I give the command "line" or "_line" the right points but AutoCAD draws the line from the vertex to the adjacent vertex. It's not just in AutoLISP, AutoCAD won't let me draw a line from a vertex to the middle of an edge in a polyline. How can I do that? I thought of adding a vertex in the polyline, but this didn't help that much. I tried to add connector: a circle or another object close enough to the line and connect the

Cannot load assembly (hr = 0x80131018)

大兔子大兔子 提交于 2019-12-11 01:55:47
问题 I have a user with issues loading a .Net assembly into AutoCAD. I get the following error: Cannot load assembly. Error details: System.BadImageFormatException: Could not load file or assembly (hr = 0x80131018) They are using an anit virus package called Endpoint Security and when this is turned off, the load works. I am not a .Net expert and was hoping there might be a friendlier solution than me suggesting the user put their anti virus package in the trash!? But I've no idea where to start,

Launch AutoCAD 2015 from .Net process

扶醉桌前 提交于 2019-12-11 01:27:55
问题 I was trying to load AutoCAD 2015 from .Net process so that I can send commands to the document to create/modify blocks. I tried both of these approaches but none of them seems to work. 1st approach: AcadApplication app = new AcadApplication(); app.Visible = true; 2nd approach: var t = Type.GetTypeFromProgID("AutoCAD.Application", true); dynamic obj = Activator.CreateInstance(t, true); In both of the cases I am getting COM exception. Any help? It's not a duplicate as mentioned in comments, I

“Attempted to Read or write protected memory” error reading AutoCad databases in parallel

和自甴很熟 提交于 2019-12-10 17:20:51
问题 I am getting "Attempted to Read or write protected memory" when I try to perform some parallel operations. I am reading AutoCad Databases into to memory to do some data mining. I can do this with a regular for loop but not with a Parallel.ForEach . Any ideas? Parallel.ForEach(_Files, (currentFile) => { var _File = currentFile; using (Database _Database = new Database(false, true)) { _Database.ReadDwgFile(_File, FileOpenMode.OpenForReadAndAllShare, false, null); _Database.CloseInput(true); //