AutoCAD .NET :: Overrule Control In BlockReference?

Jun 26, 2012

I am working on simple WorldDraw overrule where lines and polylines are displayed with little cross. Size of cross is related to view size.

Everything works fine except blocks and Xrefs. If they are scaled then crosses are scaled as well.

I know how to get entity owner ID but it refers to BlockTableRecord only not to BlockReference.

View 3 Replies


ADVERTISEMENT

AutoCAD .NET :: How To Check BlockReference

Jan 3, 2013

So i have 3 file DWG :

3.dwg : is a plan 'archi'
2.dwg is a plan with only décoration.
1. dwg is a plan with only the water.

i have this structure in my file (1.dwg) :

1.dwg
---> 2..dwg
---------> 3.dwg   (this file is a Xref of 2.dwg)

--> is the blockRefecence (XRef).

Dim CollXref As New ObjectIdCollection Dim mydb As Database = Application.DocumentManager.MdiActiveDocument.Database Dim myTrans As Transaction = mydb.TransactionManager.StartTransaction ' Dim doc As Document = Application.DocumentManager.MdiActiveDocument
[Code] ......

So i don't want to add Id of a Xref From a Xref. (In my example i want only ObjectId of the 2.dwg not 3.dwg if i launch this code on 1.dwg.

View 3 Replies View Related

AutoCAD .NET :: Sum Attribute Value Of Blockreference?

Mar 8, 2013

Do we have any way to sum attribute value (integer) of many blocks fast?

View 8 Replies View Related

AutoCAD .NET :: How To Get Block Description Through Blockreference

Dec 28, 2013

my block is a anonymous block with a blockname like "*uxxx", but,but it is not a dynamic block.

how can i get the block description through the blockreference(insert)?

View 1 Replies View Related

AutoCAD .NET :: Modified Event Of BlockReference Causes Crash

Dec 11, 2012

I have a group of classes that essentially implement the Model View Controller pattern. The view is a custom control contained in a PaletteSet. The Model is a class that wraps the ObjectID of a given block. I've used these classes to create a replacement for the Properties tool in AutoCAD (2011). Basically the UI can be used to edit the properties of a Dynamic Block. But I apply my own rules and behaviors to the UI.

I had no problems until I added support for the View to be updated when the block is modified (say by dragging to increase a length property). To do this I handle the Modified event of the block. After the block is modified, some rules are evaluated. If the rules result in changes to the block's properties, these changes are applied. This last part is where I'm having trouble. 

When the "Rule Evaluation" code is invoked because of changes to the view (WinForms Controls), I am able to update the block's Properties using the following code without issue:

Public Shared Function SetParameter(ByVal BlockID As ObjectId, ByVal ParameterName As String, ByVal Value As Double) As Boolean
Using dl As DocumentLock = Application.DocumentManager.MdiActiveDocument.LockDocument(DocumentLockMode.ProtectedAutoWrite, Nothing, Nothing, True)
Using myTrans As Transaction = BlockID.Database.TransactionManager.StartTransaction
Dim myBRef As BlockReference = BlockID.GetObject(OpenMode.ForWrite)
For Each myDynamProp As DynamicBlockReferenceProperty In myBRef.DynamicBlockReferencePropertyCollection
If myDynamProp.PropertyName.Equals(ParameterName, StringComparison.OrdinalIgnoreCase) Then
myDynamProp.Value = Value
myTrans.Commit()
Return True
End If
Next
Return False
End Using
End Using
End Function

However, when this same code is invoked as a result of the BlockReference Modified event, AutoCAD completely crashes the momment the transaction.Commit() method is called. I've attempted to catch the exception causing the crash and role back the transaction, but AutoCAD simply exits and displays the error (Error handler re-entered. Exiting now.) and no exception is caught. Note that I do not use the BlockReference instance passed to the Modified event handler. Instead I store an ObjectID instance elsewhere which is consistently used to read/write the block. 

Is there something I must do before commiting a transaction when using the Modified event of BlockReference? I checked, and the same "Main Thread" is executing whether the code is invoked from a UI event or the Modified event. I tried calling the Close method, which is attributed as Obsolete, on the BlockReference object before executing the transaction without any success.

View 3 Replies View Related

AutoCAD .NET :: Inserting BlockReference With AttributeReferences From Another Drawing

Apr 24, 2011

I need to insert Blocks with Attributes and its values from another drawing into the active drawing.  I am not sure if the way I am doing it is correct.  I am having problems with the transactions, one for the source drawing and the other for the active drawing.  I had a few eviolations problems.  It seems that I have to close the transaction of the source drawing before I can access the active drawing and the other way around.

Since it is a BlockReference with AttributeReferences and its values I firstt opened the source drawing on a side database withing its own transaction and went through the ModelSpace TableRecord until finding the BlockReference with the correct AttributeReference value.  Then, I had to store all the Tags and TextStrings on an array because I could not access the active drawing without closing the source drawing transaction. 

If the BlockDefinition exists on the active drawing then I only have to create a new BlockReference with the AttributeReferences and update its TextStrings with the values stored on the array.  All of this withing the active drawing transaction. 

If the BlockDefinition does not exist on the active drawing I could insert it  from the source drawing side database ONLY within the active drawing transaction.  I have to close the source drawing transaction first. 

Now, is there any way of doing this that won't require switching transactions?  Is it possible to find the BlockRefence on the source drawing from the active drawing transaction? 

View 3 Replies View Related

AutoCAD .NET :: Select Overrule Entity

Jul 23, 2012

I have a question regarding object overrule.

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).

View 3 Replies View Related

AutoCAD .NET :: How To Overrule On Custom Object

Aug 9, 2012

I want to change display of custom object using overrule.

First I made a class implements from polyline.

class BoundaryPolyline : Autodesk.AutoCAD.DatabaseServices.Polyline { }
 
Second I made a polylineJig to draw my custom polyline(BoundaryPolyline).

 public class PolylineJig : EntityJig { public PolylineJig(Point3dCollection p3ds) : base(new BoundaryPolyline()) { ... } ... }

 And then add overrule on BoundaryPolyline to change display of it.

Overrule.AddOverrule(RXObject.GetClass(typeof(BoundaryPolyline)), mydrawOverrule, false);

 But when I loaded dll, fired overrule and redraw. All polyline display were changed.

Then I found that 'RXObject.GetClass(typeof(BoundaryPolyline)' was return 'Polyline' but not 'BoundaryPolyline'.

How to overrule on custom object.

View 5 Replies View Related

AutoCAD .NET :: Blockreference Position And View Coordinate System?

Aug 5, 2013

I have rotated my view about 15 degress (just for this example).Now I prompt user to select the point, which is also an insertion point of the block.

So we have:

- selected point: X=0, Y=294, Z=0;

- insertion point of the block: X=0, Y=294, Z=0

(this is what I have in properties list or when I execute LIST command).

Now in my

ed.WriteMessage("
Base X: " + basePoint.X.ToString()); ed.WriteMessage("
Base Y: " + basePoint.Y.ToString()); ed.WriteMessage("
Block X: " + blkRef.Position.X.ToString()); ed.WriteMessage("
Block Y: " + blkRef.Position.Y.ToString());

 This gives me:

Base X: -2.89976376244283E-14 - OK
Base Y: 294.058394637539 - OK
Block X: -76.1079129044681 - BAD
Block Y: 284.038597817502 - BAD

My question - why blockReference position is different that it should be?

View 2 Replies View Related

AutoCAD .NET :: Selecting Nested Entities And Inheriting From BlockReference

May 1, 2012

My primary goal in this exercise is to select a nested polyline within a block and have access to its grips. I'm still not even sure if it's possible.

However, before I'm even getting to that stage I'm hitting some problems. I have some custom objects which all in some way or another inherit from BlockReference:

BlockReference

-Derived Abstract Class with common attributes

-Derived Concrete Class1

-Derived Concrete Class2

-Derived Concrete Class3

I insert instances of my derived concrete classes using jigs( Class2 for example is created using a polyline jig). However, when I select the block generated from it using a PromptSelectionResult, it returns a BlockReference, not the derived concrete class, not the derived abstract class.

When I try and cast that as the correct class type I get an error telling me I can't cast from the Base class to any of the derived classes.

So, firstly, why is it returning a BlockReference when the object I'm clicking on is an instance of a type that indirectly inherits BlockReference? And is it even possible to gain access to a nested entity's grips? I followed post here: [URL] .... but it doesn't give me what I need.

I've tried ed.GetNestedEntity and the AllowSubSelections property of PromptSelectionOptions and had little joy.

View 3 Replies View Related

AutoCAD .NET :: Cloned ObjectID Or Handle Using An Overrule

Aug 19, 2011

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

View 2 Replies View Related

AutoCAD .NET :: DeepClone Overrule And Dynamic Block Jigs

Aug 17, 2011

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.

View 1 Replies View Related

AutoCAD .NET :: Overrule Attributes (properties) For Complex Objects

Jan 6, 2013

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;
}

[code]....

View 8 Replies View Related

AutoCAD .NET :: How To Add Hatch To Closed Curve In Drawable Overrule

Apr 11, 2013

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].......

View 3 Replies View Related

AutoCAD .NET :: Overrule Specific Sub Entity In Block And Not Showing The Base

Aug 11, 2012

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].......

View 9 Replies View Related

AutoCAD 2013 :: Control Print Line Weights On Feature Control Frames?

Nov 8, 2012

Using AutoCAD 2013 and TOL command to generate feature control frames.  We set our lineweights based on layer assignments.

Problem is that when printing, AutoCAD seems to randomly assign a lineweight to the feature control frames.  It can vary from what it's supposed to be (such as lineweight set for the dimension layer) or thicker than even what the object lines are set at.  Seems to pick a random linewieght at time of printing for these elements (just the boxes, not the symbols/text itself).

Is there a setting we should be defining somewhere to force it to follow the lineweight of the layer that it has been assigned to?  Known bug?

View 4 Replies View Related

AutoCAD .NET :: Add New Grip Point With Grip Overrule

Oct 18, 2012

Before I will explore Grip Overrule world I have one question. Is it possible to add new grip points into Entity?

View 6 Replies View Related

AutoCAD Inventor :: Control Parameter With XML?

May 27, 2012

in Inventor 2010 we can save and load iLogic Paremeter with *.xml and just in my opinion we can control parameter using *xml or html. It's right or false?

how to control Inventor parameter with *.xml?

View 2 Replies View Related

AutoCAD Inventor :: Get Value From A Control At VBA Form

Apr 4, 2013

I'm trying to enter a model parameter value with a VBA form, but I don't know which type of control to use neither how to write the code. I want to enter a number or a value with any control and use this value for modify a model parameter.

I have a simple code with a line:

oModelParams.Item("z").Value = 25

I want to make something like:

assuming that "TextBox1.Value" is a numeric value obtained with a control at the form

oModelParams.Item("z").Value = "TextBox1.Value"

View 1 Replies View Related

AutoCad :: How To Control Color Settings

Jun 20, 2012

Using autocad LT 2008. I am working in the constriction field. Usually I receive a drawing from the architect , than I need to create my version of his drawing , meaning I need to emphasis the important construction geometry. AutoCAD speaking, im using the CTB file to control this color request

1. I set all 255 pans to gray (architect plane fade out)

2. I set random color to blue (emphasizing my geometry)

View 1 Replies View Related

AutoCad :: How To Add New Control Vertex And A Handle

Jul 4, 2013

How to add a new control vertex of a spline and how to show the handle of the spline such as in Adobe Illustrator?

View 1 Replies View Related

AutoCad 2D :: How To Control Appearance Of Dimensions

Jul 23, 2013

I am trying to dimension a drawing and I get some strange results

Bad Dimensions.jpg

How do I control:

1. the size of the arrowheads;
2. the size of the text;
3. how the dimensioning lines contact the object being dimensioned;
4. etc.

View 4 Replies View Related

AutoCad 2D :: How To Control Display Of Dimensions

Jul 20, 2013

Having drawn this spacer for the tutorial I am following, I decided to add the dimensions. The dimension shown here is 200mm but you wouldn't know that.

Dimensions 20-07-2013 10-25-32 AM.jpg

How do I set the dimensions so I can see the arrowheads and read the text?

View 2 Replies View Related

AutoCAD Civil 3D :: Layer Control Drop Down

Sep 6, 2013

I'm working on Civil 3d 2012 and when it's set on Autocrad classic profile I can select my layers right in the drop down list by typing the first letter of the layer and it goes to it. But when my profile is set on Civil 3d, I can do the same in the layer drop down. Is there a way to set it like autocad classic?

View 1 Replies View Related

AutoCAD .NET :: JavaScript And WebBrowser Control Error

Feb 15, 2013

I have a Form with a WebBrowser Control loaded with a html file with JavaScript, all the javascript functions and interaction with vb.net are working fine, but when I close the Form and open again (or go to another drawing and I try to open it there) happens a fatal error.

View 9 Replies View Related

AutoCAD LT :: Make A Custom Toolbar Control

Jul 2, 2013

I downloaded autocadlt14 today.  I am able to get into the program and go to autocad classic.  I can open my drawing from autocad2002 and work with them. When I try to create a custom toolbar in classic it does not save it when I close the program.

View 1 Replies View Related

AutoCAD 2013 :: Control Keys Not Working?

Oct 16, 2013

When I try and save (Control+S), nothing happens.  I noticed none of my control keys do anything.

View 2 Replies View Related

AutoCAD 2010 :: Control Visibility Of XRef

Jul 4, 2012

Any way to control the visibility of any XRef in a drawing using Excel or Text file. For instance, I have 50 Xref placed in there positions and I want AutoCAD to select what should be visible by reading an external file--Excel or Text file.

View 1 Replies View Related

AutoCAD Inventor :: How To Control A Design On Autodesk

Jan 23, 2013

I have made a design on autodesk inventor along with gear and motors which give input to the mechanism. (Stewart Platform)

I am able to test the design by giving a random rotary input to a motor component which features availabe on Inventor.

However, I want to control that input somehow. I just want to enter the final coordinates the design needs to reach and the motors should be actuated automatically so as to reach those coordinates.

I have a MATLAB code for the purpose but am unable to understand how to connect it to Autodesk Inventor. 

View 1 Replies View Related

AutoCAD LT :: Can't Control Size Of Multiline Text Box

May 15, 2013

This has been happening intermittently but now seems to be permanent. When I slect the Multiline tool, click to place the text box, then click to place the other corner the box ignores the size I set and snaps to as wide as the screen and one line high. It does this in several different drawings so it is not native to one. If I enter text and deselect I can adjust the handles and alter the text.

I have attached a screen shot to show. It doesn't matter how close or far I am zoomed in on the drawing.

For what it's worth I do not like the way the ribbon panel controls handle text, it usually takes multiple tries to get it to change the text height. I usually resort to using the Properties flyout but that adds mutltple steps to the process.

View 9 Replies View Related

AutoCAD Map 3D :: Control Weight Of Line For Hatch?

Jan 30, 2013

Is there a way to control weight of line for hatch?

I'm trying to make some style for number of areas and when I do hatch on a paper it's almost invisible because it's weight!

Tons of hatch patterns and they all useless!?

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved