FAQ Database Discussion Community


AutoCAD: Access group pivot in C#

c#,autocad,autocad-plugin
I am writing a plugin for AutoCAD in C#. I would like to change the position of the pivot point of a group. It is possible to do that by mouse clicking but after deselecting and reselecting the group, it automatically moves back to it's default position (which looks like...

Using C# to Join AutoCAD Entities into a Block Programmatically

c#,autocad,autocad-plugin
I'm trying to write a method that prompts the user to select all the entities they want to combine into a block and then joins them together into a block and returns the block reference. Right now it looks like this. /// <summary> /// Returns all entities in an AutoCAD...

Programmatically get the location of a block in AutoCAD with its ObjectId

c#,autocad-plugin
I'm trying to write a method to change an existing block in an AutoCAD drawing. In this case, I want to change the length of a block by changing its scale factors. The method I've written will accomplish that by deleting the old block and creating a new one with...

Entities wrong when importing multiple DXF files

c#,.net,autocad,autocad-plugin
I have 3 different BlockTableRecord's that I want to update. I am loading external .dxf files that contain the entities for each block definition. Now when I delete the old entities and load in the new ones it works perfectly fine but as soon as I start updating the second...

Set default value for string prompt

c#,.net,autocad,autocad-plugin
The editor class has a method called GetString which prompts the user for a string value via AutoCAD's command prompt. I call it in this wrapper method: public static string PromptUserForString(string message = "Enter a string: ", string defaultAnswer = "") { return _editor.GetString("\n" + message).StringResult; } The argument message...

AutoCAD C# Select objects after SendStringtoExecute

c#,autocad,autocad-plugin
Does anyone know how to select objects after SendStringtoExecute? The best for me is select object using fence or a point. Here's the part of my code: foreach (ObjectId objId in NormalblkTblRec) { if (objId.ObjectClass.Name == "AcDbArc") { Entity en1 = (Entity)trans.GetObject(objId, OpenMode.ForWrite); Arc arcs = (Arc)(Object)en1; Point3d[] arcpoints =...

How do I check if Point3d is not null?

c#,null,nullable,autocad,autocad-plugin
My approach was... Autodesk.AutoCAD.Geometry.Point3d point = null; but I can't seem to set a Point3d to null. Can anyone tell me why and how I would check whether a Point3d is null? (By Point3D I mean Autodesk.AutoCAD.Geometry.Point3d)...