Simple example, when overrule Line entity to draw three entities Line, Text, Circle when selecting overruled Line is it possible to identify what object have been selected (in this example it could be Line, Text, Circle).
Planning to overrule some of sub entities in a block. Let's make it simple . All lines and attributes in block should be circles and original block should not be seen. I came up with below code.
The code reacts differently if I remove
MyBase.WorldDraw(drawable, Wd)
and my goal is not to show the real block. Just showing whatever is overruled.
Public Class toverrule Inherits Autodesk.AutoCAD.GraphicsInterface.DrawableOverrule Public Overrides Function WorldDraw(ByVal drawable As Autodesk.AutoCAD.GraphicsInterface.Drawable, ByVal Wd As Autodesk.AutoCAD.GraphicsInterface.WorldDraw) As Boolean Dim myBlock As BlockReference = CType(drawable, BlockReference) If Not myBlock.Database Is Nothing Then [code].......
I am new to Inventor API, but have some experiences in SolidWorks API.
How can I select an entity at a given spacial point (x, y, z)? For example, I want to select a face or edge that is on a given (x, y, z) point. I can not find such an API, except for interactive selections.
i dont want use editor (i don't want use CommandFlags.Session)
after the load in the database (see my code for xdb), i want to select all bloc within a closed line entity (within the xdb)
but how to do that whitout editor (editor..SelectWindowPolygon )
here my code for load each file , and mémorize all block for each file
Dim CollDocOuvert As New Collection For Each NomFichier In Fenetre.CollFichier 'recherche et extraction des blocs Dim Fichier As New IO.FileInfo(NomFichier) If Fichier.Exists = True Then GestionAUTOCAD.TxtOnLigneCOmmande("Gestion du
[Code]....
StatusLabelBar is a component of my form for write msg. is use me.refresh and a timer (1s) for refresh my form. (a trick i have found for do this [if you have better trick i take it.])
know if there is a command which joins GetEnttiy() and GetPoint() functions. At the moment I'm using both commands one after another. Result I want would be one command where you can choose entity or select insertion point.
I am looking for some code that would allow me to select a MTEXT Entity - or other entity - (as the DEFAULT option) but also to allow me to type in some text manually or to pick a point in the drawing. Something that would present the user with:
"Select an object or [P to pick a point]" or
"Select MTEXT or [M to type].
I can write some code to type in text manually as the default option and get the second option to select entity using get string and then write some condition of if code but I don't know how to do it having entsel as default option.
I need to use the Handle of the cloned object during a DeepClone override but AutoCAD shuts down when I try to use it.
This is the best I can think of but it still boots me out when I try.
Public Overrides Function DeepClone(ByVal dbObject As DBObject, ByVal ownerObject As DBObject, ByVal idMap As IdMapping, ByVal isPrimary As Boolean) As DBObject Try Return MyBase.DeepClone(dbObject, ownerObject, idMap, isPrimary) Catch Finally CompileCloneObjects(dbObject.Handle.ToString, MyBase.DeepClone(dbObject, ownerObject, idMap, isPrimary).Handle.ToString) End Try End Function
If I add a DeepClone overrule on Initializeing a drawing it stops my block Jigs from showing correcly. I get a line drawn instead of the block. Other overrules I have used don't cause any problem.
By excluding the overrule from the initialize event it works fine.
I can remove then add the DeepClone overrule before and after the jig and it works ok but I really need it active on drawing startup.
Hit the brick wall again.
Ideally I don't use an overrule. All I need to do is understand what objects are being cloned before, during or after a clone operation but can't figure out the idmapping thing.
I am about to write the function using Overrule API to temporary override object’s colour to ByLayer for all entities in the drawing.
At this moment I just have simple class for testing (just to check if it is possible) and so far I can see problem with complex entities.
Entities such as Line, Polyline even BlockReferences work fine but complex objects like HATCH, MTEXT and LEADER do not change colour as set in SetAttribute method.
Below is simple class I was testing.
public class ByLayerColorOverrule : DrawableOverrule { public override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.Drawable drawable, Autodesk.AutoCAD.GraphicsInterface.WorldDraw wd) { base.WorldDraw(drawable, wd); return true; }
My goal is to write a Drawable Overrule, which would change the entities color to dark gray, except when they are on a specific layer. For closed-only curves in this layer, I want to add a semi-transparent hatch.
All works great, until user moves the mouse over this hatch : AutoCAD throws a fatal error and closes. I've no exception in debugger...
When I remove the code concerning the hatch, I've no error at all.
Public Class ClosedCurveDrawableOverrule Inherits DrawableOverrule Public Const HighlightColorIndex As Short = 1 'Color Red Public Const BaseColor As Short = 251 ' Color DarkGray Public Const SpecificLayer As String = "Layer1" ' Set our transparency to 50% (=127) ' Alpha value is Truncate(255 * (100-n)/100) Public [code].......
I need to export points from 3D map as a .shp file so I can bring them into Maya and have them line up exactly where they need to be based on their coordinates. The points line up pretty close to right in map 3d, and they have a style assigned to them. When I go to the Map --> Tools --> Export, I choose .shp as the file output, and go through and select the layer I need to export. When I've got everything set up, I get an error message saying "no entity to export." I have searched on the internet for this error but not a lot comes up. I'm not sure what I'm missing in order to make the points export.
I'm trying to add an attribute to an entity, however it seems that the AttributeDefinition requires a Point3d and as such appear in my modelspace. I don't want this, i just wanted it to appear as an attribute with a value when i click on my entity, is there any way of making it so that i does not add into modelspace?
BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead);for (int i = 0; i < prSelectionResult.Value.Count; i++){ // Get the entity the user had selectedEntity ent = (Entity)trans.GetObject(prSelectionResult.Value[i].ObjectId, OpenMode.ForWrite);if (ent.GetType() == typeof(BlockReference)) { // Add attribute to layerBlockReference blockRef = (BlockReference)ent;. [code]...
I have a method DrawMLeaderLine(Database db, Transaction tr, Point3d point, string text) that draws me a MLeader line to the given point with the given text as annotation. The MLeader line points to the midpoint of a Line entity. What I need is a binding between the Line midpoint and the MLeader line, so when I move or resize the Line, the MLeader line should follow! I already tried to solve that, using constraints, but it doesn't work for Leaders.
This is my code...
public static MLeader DrawMLeaderLine(Database db, Transaction tr, Point3d point, string text) { Point3d mTextLocation = point + new Vector3d(5, 5, 0); BlockTableRecord btr = tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord; MText mText = new MText(); mText.SetDatabaseDefaults(); mText.SetContentsRtf(text); [code]........
will be called from a different class...
Line line = DrawingUtil.DrawLine(doc.Database, tr, closestPoints.Item1, closestPoints.Item2); //Get midpoint of line double midPointX = (line.EndPoint.X + line.StartPoint.X) / 2.0d; double midPointY = (line.EndPoint.Y + line.StartPoint.Y) / 2.0d; Point3d midPointOfLine = new Point3d(midPointX, midPointY, 0); //Draw the leaderline MLeader leaderLine = DrawingUtil.DrawMLeaderLine(doc.Database, tr, midPointOfLine, "Connection");
Can you add an attribute to a non-blocked entity? Basically, I want to "name" plines.
In case I'm going about this wrong, let me ask the question another way. I'm just getting used to the wonders of attributes & data extraction (I love it!). Right now I have blocks with attributes that I use data extraction to count. I also need some way to calculate length. These blocks represent electrical devices - then I need to calculate the amount of wire used to connect the devices.
So now I use a pline to join the devices, get the length of that polyline, and then manually enter that length into the spreadsheet from the data extraction. But...I'm thinking if I can link an attribute to a pline, then I can include that in the data extraction and automate it. But I don't see how I can use a block for this, since the pline will be completely variable and needs to be "custom-fit" for each circuit.
is there any way to check the entity selected by NonInteractivePickPoint? iwant to get the ownerid if the item selected is a 3d or 2d vertex. How is it written in vb.net?
I have a client that just started using C3D 2010. When I sent him a topographic survey with contour lines (I am also using C3D 2010) he called me and asked if there was a way to select an individual contour line and have it display the elevation in the 'properties' dialog box. I have not been able to find an answer for him.
For AutoCAD 2006, I have an entity that I am changing properties of, but I cannot figure out how to set the colormethod to "By Layer." I am sure that I am missing something, but I am at my wit's end.
I'm borrowing from the samples library in the Inventor:
Public Sub GetSingleSelection()
' Get a feature selection from the user Dim oObject As Object Set oObject = ThisApplication.CommandManager.Pick(kPartFeatureFilter, "Pick a feature") MsgBox "Picked: " & oObject.Name
End Sub
Works fine, and is fairly simple, but the problem I'm having is if I press the escape key after starting the command, but before making my selection, I'm not able to start the command again.
I realize from my searching that using the Selection (Simple) sample allows for an interrupt, with some modification, was just wondering if there was something similar for this simpler selection option.