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


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 :: 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 :: 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 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 :: 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 VB :: 2011 Batch Convert Field Attribute To Text Attribute In Blocks Using VBA

Jun 3, 2011

I've got hundreds of files to convert. 

In VBA, how can I batch convert field attributes in blocks to text attributes while retaining the blocks?  Is there a simple way to univerally convert them all at onceusing VBA?  The plotted values for the fields must be retained, too.

Explode will not retain the value of the field.

Burst will not work as it explodes the blocks as well.

You can right-click on the field and slelct "Convert to text" from the RCM.  So I know that the process exists within CAD, just need to batch the process for a quantity of DWGs at a time - in VBA.

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Transfer Attribute Block Values To Another Attribute Blocks

Jul 3, 2012

I wanna transfer my attribute block values to another attribute text blocks , is there any lisp for that?

Is there a possibility for sum tag values of choice attribute blocks to inside of another attribute text block ?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Convert Attribute Tag Into Attribute Value?

Dec 8, 2011

Background: Someone exploded an attribute block and copied it hundreds of times throughout a project, each time changing the Attribute Tag to match the Value they expected to appear in their drawing.  The drawing must be xrefed, so the attribute definitions do not appear.

(There is only 1 attribute in the block.) 

Proposed Solutions:

1:AutoLISP routine which copies Tag data from Attribute Definition into Value of Attribute Block:

Prompt-Select Attribute Definition

Copy Tag data

Prompt-Select Attribute Block

Paste data into Value

(Allow repeat to speed workflow)(*PREFERRED*)

2:AutoLISP routine which copies Tag data from Attribute Definition into Default Value and creates a new Block:

Prompt-Select Attribute Definition

Copy Tag data

Paste data into Default Value

Create New Block

(Select Multiple Objects)(Creates tons of new blocks which are messy)

View 3 Replies View Related

AutoCAD .NET :: Attribute Reference Text String MText Attribute

Mar 16, 2012

I am using M Text Attributes to store imperial lengths in the drawing, feet inches and fractions (stacked).  When I read back the Text String property which, is the M text Attribute.Contents parsed, I am having problems because the parser does not add a space between the inch and the fraction.  So, is there any setting that could be used to tell the parser to add the space between the inch and the fraction? 

View 1 Replies View Related

AutoCAD 2010 :: Can't Change Attribute Value In Enhanced Attribute Editor

Dec 21, 2012

creating a block with attributes. I did manage to get my block set up and inserted in a dwg, but I am unable to change the "value" of any attribute. Unless I click on the "..." button next to the value field.

View 1 Replies View Related

AutoCAD 2010 :: Change An Attribute From A Value From Another Attribute In The Same Block

Oct 5, 2012

What I really want to do is on our fire alarm blocks we have 3 different attributes one for the address, the candela and one for misc info. I want to make an attribute that takes the number from the candela (15,30,75or 110) and change a different attribute to a value depending on which candela we use (such as 15=.078, 30=.113, 75=.195 or 110=.259). But I don't want the .078,.113,.195,.259 to print out on paper, I want to export block information excel file so I can add up all values.

View 2 Replies View Related

AutoCad 2D :: Copying Attribute Values To Another Attribute?

Jun 15, 2013

I want to copy attribute values. I'm making a catalogue of all the reinforcements in my drawing so I need to name those reinforcements. So what I want is to make a string of text that I don't need to totally modify everytime. Something like this:

Amount of reinforcement bars - 5
Diameter of the reinforcement - 12
Division of reinforcing bars - 100
Reinforcement bars: 5-T12-k100

So the only attributes I'd edit would be the first three not the last one. So how can this be accomplished?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Check Block Attribute Then Change Different Attribute In Block

Aug 31, 2012

select all blocks on certain layers in a drawing, check attribute CIRCUIT in each block if it starts with MS then attribute CONTROL = switched. I hope thats clear enough the way

(defun c:control()
(graphscr)
(Setq sc (ssget "X" '((0 . "INSERT")

[Code].....

View 1 Replies View Related

AutoCad 2D :: How To Add A Attribute

May 3, 2011

I am trying to use the tag object in the tool pallate. How do you add a attribute quickly. Block editor. It only has one attribute i need the tag to show detail/sheet.

View 1 Replies View Related

AutoCAD VB :: Getting Constant Attribute

Mar 20, 2012

How I would be able to grab the block constant attribute by searching via tag.

e.g. block has a constant attribute 'Color' with value of 'red' and I wish to attain 'red'

I am currently obtaining non constant attributes using:

Dim attRef As AttributeReference = DirectCast(tr.GetObject(attId, OpenMode.ForRead), AttributeReference)

and grabbing the '.textstring' when looking at the '.tag'

How do I go about this with similar logic but pointing to constant attributes? I have tried searching thoroughly and almost all results for me were in VBA.

View 6 Replies View Related

AutoCad :: Variable Box Around An Attribute

Jun 29, 2012

Is it possible to have a rectangle, around a single attribute, change it's with as the attribute changes in width?

View 1 Replies View Related

AutoCad :: Fields In Attribute

Mar 14, 2012

Any short cut to update the fields in the attribute without double clicking on the block attribute to change.

I'm looking for something to write in the command line.

View 9 Replies View Related

AutoCAD .NET :: Get Attribute From A Block

Feb 2, 2012

I need to open a drawing and read the block attributes and find a block with name "ABC" and attribute named "Text" in "ABC" block. for which i am using the below code which is working perfectly.

Try AcadApp = GetObject(, "AutoCAD.Application") Catch ex As Exception AcadApp = CreateObject("AutoCAD.Application") End Try AcadApp.Visible = True Try AcadDoc = AcadApp.Documents.Open(DWGName, True) RichTextBox1.AppendText(" - Opened File Successfully" & vbCrLf) Me.Refresh() Catch ex As Exception RichTextBox1.AppendText(" - Can not Open this Drawing" & vbCrLf) Me.Refresh() Exit Function End Try Dim Obj As Object For Each Obj In AcadDoc.ModelSpace If Obj.ObjectName = "AcDbBlockReference" Then RibbonLabel1.Text = "Find Block: " & Obj.Name Me.Refresh() ' Check for attributes. If Obj.HasAttributes Then Dim AttList As Object Me.Refresh() If Obj.Name.ToString.ToLower = "abc" Then ' Build a list of attributes for the current block. AttList = Obj.GetAttributes ' Cycle throught the list of attributes. For _i = LBound(AttList) To UBound(AttList) ' Check for the correct attribute tag. If AttList(_i).TagString = "Text" Then return AttList(_i).TextString.ToString End If Me.Refresh() End If Next End If End If End If Next Obj

 But i want to know whether is there any way to get the block named "ABC" directly without looping through all the objects.

View 2 Replies View Related

AutoCad :: Drawing Name Attribute

Jul 21, 2011

I recently cam across a block that had an attribute that showed the current drawing name, and if the drawing file name was changed the attribute value changed to match.

How this is done? I looked at the attribute properties and could not figure it out.

View 6 Replies View Related

AutoCad :: Attribute To Geometry?

Nov 11, 2011

I have a survey plan with a ton of blocks in it.

The blocks have the elevations in the attributes, but i want the elevation in geometry position z.

View 3 Replies View Related

AutoCAD Map 3D :: Block Content Many Attribute?

Feb 21, 2012

I have a block content many attribute.  When I'm create the block whit this many attribute, the order of this attribute is not properly.  I know autocad have a command to class this many attribute in order but i search it and i don't know where is it.

View 1 Replies View Related

AutoCAD Map 3D :: Incorrect Attribute In Table

May 6, 2013

I tried to bring in a shapefile to AutoCad Map 3D 2013 and I realized the attributes in the table were incorrect.  There should be no negatives for the column CLN_NUM_ID. 

And it appeared that the CLN_NUM_ID is totally incorrect.  Then I realized the data type of CLN_NUM_ID is Long integer so I changed the datatype to DOUBLE in ArcMap. When I brought in the shape file, the program crashed. 

View 7 Replies View Related

AutoCAD .NET :: Attribute Collection From A Non-placed Block

Apr 19, 2011

I need to get the Attribute Collection of a named block which is not been placed in the drawing, but it does exist

Dim paaltype As String
Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim acCurDb As Database = acDoc.Database
Dim acDocEd As Editor = acDoc.Editor

Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
paaltype = "paal01"
Dim acBlkTbl As BlockTable
acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead)
If acBlkTbl.Has(paaltype) Then
‘block exist, how to get the attributecollection
End If
acTrans.Dispose()
End Using

View 2 Replies View Related

AutoCAD LT :: Extracting Attribute Values In It?

Apr 20, 2013

I just want to extract the coordinates and number of survey locations that are represented by point blocks from a drawing.

My template is on the desktop and is named

TAYLOR EXTRACT.txt
BL:NAME C008000
BL:COMMENT C008000
BL:NORTHING N0010003
BL:EASTING N0010003

I get the attribute extraction menu

select some points, verify that points have been selected

specify the above template

Specify the export file name

select ok

returns 0 records

View 9 Replies View Related

AutoCAD .NET :: Attribute To Move To Block Without Old ATT?

Sep 10, 2012

How can I add an attribute to a block without the other attributes to move from their position. With the ATTSYNC belongs unfortunately not because the old attributes moved back to the original places that I will not.

View 9 Replies View Related

AutoCAD .NET :: Append Attribute To Block

May 9, 2011

I wan't to append a new attribute to a new block. But I get an error that there is no database. The loaded file has no attributes

Dim mDialog As New frmPaalDefinitie()
For Each item In lvPalen.Items
mDialog.tsPaal.Items(item.imageindex).enabled = False
Next
mDialog.ShowDialog()
If mDialog.DialogResult <> Windows.Forms.DialogResult.OK Then Exit Sub

[Code] ........

View 4 Replies View Related

AutoCAD .NET :: Writing Attribute Values

Feb 29, 2012

I'm trying to write some code that adds values to attributes of a specified block. I'm able to search for the block, but I'm having trouble editing it.  

Dim acDoc AsDocument = Application.DocumentManager.MdiActiveDocument
Dim acCurDb AsDatabase = acDoc.Database
Dim acTransMgr As Autodesk.AutoCAD.DatabaseServices.TransactionManager= acCurDb.TransactionManager

Using acTrans1 AsTransaction= acTransMgr.StartTransaction
Dim acBlkTbl AsBlockTable = acTrans1.GetObject(acCurDb.BlockTableId, OpenMode.ForRead)
If acBlkTbl.Has("blockname") Then 

*** here I need to get the object found in the active block table and edit it's attributes by attribute name ****
End If
End Using

View 4 Replies View Related

AutoCAD .NET :: Change Text In Attribute?

Jul 31, 2012

I am trying to change a text in attribute using vb.net.

I am using the following sub to update my attribute, if I use the message box I get correct information about the block, the attribute.tag I want to change and the text. The changes to my attribute are not saved.

Sub UpdateAttributeValue(ByVal BlockID AsObjectId, ByVal AttributeTag AsString, ByVal TextaStr AsString)   
Using myTrans AsTransaction = BlockID.Database.TransactionManager.StartTransaction
Dim myBRef AsBlockReference = BlockID.GetObject(OpenMode.ForRead)

[Code].....

View 5 Replies View Related







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