AutoCAD .NET :: Add XData To Appended Block

Nov 30, 2011

When capturing the Object Appended event of a block containing a "Drawing_No" attribute tag, then trying to add xdata to the object, I get a "Object reference not set to an instance of an object" error. I've tried writing the XData after committing the transaction but it didn't work.
 
If TypeOf e.DBObject Is BlockReference Then Dim bref As BlockReference = DirectCast(e.DBObject, BlockReference) If bref.AttributeCollection.Count <> 0 Then For Each attId As ObjectId In bref.AttributeCollection Dim attRef As AttributeReference = trans.GetObject(attId, OpenMode.ForRead) Select Case attRef.Tag Case "DRAWING_NO" WriteTitleBlock(e.DBObject.ObjectId) '<<Subroutine used to add XData Exit For End Select Next End If End If

View 7 Replies


ADVERTISEMENT

AutoCAD .NET :: Selection Filter On Block Reference XData

Apr 12, 2007

I'm trying to use a Selection Filter on Block Reference XData value. But I get no hits, it works fine with Lines and Polylines that has the same kind of XData.

Is it a bug or do I have to define my Selection Filter differently when working with Block Reference?

Here is a part of the code :

TypedValue[] flt = new TypedValue[]
{
new TypedValue(-4, " new TypedValue(-4, " new TypedValue(8, "POLYLINE_LAYER"),
new TypedValue(1001, "Object_Id"),
new TypedValue(1000, "166448"),
new TypedValue(-4, "AND>"),
[code].......

View 3 Replies View Related

AutoCAD .NET :: Adding Xdata To Dynamic Block With Attribute

Aug 31, 2011

My code add xdata to any object properly except for a dynamic block with attribute. After code excutes it disappears from screen . Even undo make strange thing. I guess I screw the database somehow. But even audit doesn't show any fix applied.

Attach is a sample drawing. And below is my code.

<CommandMethod("pppp")> _ Shared Sub test1()
Dim Mydwg As Document = Application.DocumentManager.MdiActiveDocument
Dim Mydb As Database = Mydwg.Database Dim Myed As Editor = Mydwg.Editor
Dim MyRegisterApplication As String = "My_R_Cad"
[code].....

View 4 Replies View Related

AutoCAD .NET :: Getting Coordinate Of Lastly Appended (added) Point Object

May 2, 2012

I am trying to get the coordinate of the lastly appended(added) point object.

It seems like I need to use "ObjectAppended" event.

However, when the event is triggred, it looks like the sender object is "Database" (not Point object).

How could I retrieve the point object therefore the coordinates of the point using "Database" (sender object)?

View 3 Replies View Related

AutoCAD 2010 :: Appended Layer Name When Copy / Past Annotative Objects

May 14, 2012

Seem like when I cut and paste objects from one file to another, particularly objects with different annotative scale, my lexisting ayers would get corrupted. Standard layer names will be appended with "@_96" at the end (i.e. "symbols" to "symbols@_96"l . The 96 would represent the annotative scale factor in the current file. If I exit out and reopen the file, all layer names will return bsck to normal. However if I cont. to work on the file for a long time, the file will get corrupted. when restore, a lot of annotative symbols that where on different "@_96" layers will merge into on new "audit" layer. Sometimes the symbols show up with a different current annotative scale

View 2 Replies View Related

AutoCAD .NET :: Changing Xdata

Sep 6, 2011

Why this code doesn't modify the xdata. I copied and modified another post.

it doesn't throw any errors. and objNewResBuf seems to have the right data.

Private Sub ChangeXData(ByVal objEntId As ObjectId,
ByVal strAppName As String)
Dim objDB As Database = objEntId.Database
Dim objTrans As Transaction = objDB.TransactionManager.StartTransaction
Dim objEnt As Entity = CType(objTrans.GetObject(objEntId, OpenMode.ForWrite,

[Code]....

View 2 Replies View Related

AutoCAD .NET :: Can't Dispose Xdata

Feb 13, 2012

i have a combo box which choose from 3 items one is blank. the triggered item changed event will erase the old set of corresponding xdata in the selected object and populate with new ones read from different text boxes. i was able to set the xdata for the first time ok. but when trying to dispose it won't dispose.

Imports System.RuntimeImports Autodesk.AutoCAD.RuntimeImports Autodesk.AutoCAD.ApplicationServicesImports Autodesk.AutoCAD.EditorInputImports Autodesk.AutoCAD.DatabaseServicesImports AcApp = Autodesk.AutoCAD.ApplicationServices.ApplicationImports

[Code]....

Civil 3D 2012
Work: Xeon W3503, 12GB, Quadro 2000, Dell P2211H x 2
Home: 3930k, 12GB, GTX 590, U3011, QX2710

View 6 Replies View Related

AutoCAD .NET :: XData To Polyline And Blocks

Apr 10, 2013

I am trying to store some data to polyline entities. and I'm planning to use xdata. Is it possible to store some string and integer values? Also each of them should have a tag name like block attiribute names.

For example:

Type= "XLPE"
Capacity= "Medium"
LengthMultiplier= 3
thickness=5
etc.

I searched internet for utilizing xdata, and it seems that Xdata is only for predefined types such as: datalayername, dataycoordinate, datazcoordinate,datascale etc. And it seems it is not possible to store more than one string with tag name.

View 1 Replies View Related

AutoCAD .NET :: Copying And Pasting XData Between Drawings

Sep 8, 2011

How can know if entities are being manually copied and pasted between drawings.A thought is to add a GUID to each entities Xdata and check if the value is in the named object dictionary. 

View 6 Replies View Related

AutoCAD VB :: Xdata / Reactor Length Of Lines?

Oct 7, 2013

I have a lot of lines that I need a length, like in attached file. At this moment I do it with a vba  that put fields in all lines.

The problems:

1) fields makes drawing slow to regen or after I modify line.

2) fields not follow lines slopes and position, if I stretch or move one end point of line. Text must be in middle of line.

So I thinking use reactors .

I tried reactor but I don't have much experience in lisp and I am having problems with persistent reactors, after I close file and open again, load lisp. Reactor not continue persistent. 

This is a test that I tried. Works only for one line.

(defun print-align-text ( owner reactor lst / sp ep a d )
(setq sp (vlax-curve-getstartpoint line1))
(setq ep (vlax-curve-getendpoint line1))

[Code]..... 

I have read that is better store data using XData. In VBA I tried construct class module with events, without any success.

View 9 Replies View Related

AutoCAD .NET :: Error When Submitting Result Buffer To Xdata

Feb 21, 2013

I'm taking over some code from a developer that is no longer here.  Right now when the code saved a resultbuffer object to xdata, I get an eregappidnotfound.  Due to various forums, I believe this is because the ID is not being registered with the database before it's being inserted.

The error is thrown on this line: XData.ToXData(partCollection);

using (Autodesk.AutoCAD.DatabaseServices.DBObject dbObj = t.GetObject(objId, Autodesk.AutoCAD.DatabaseServices.OpenMode.ForWrite)){ DeviceName.SetDeviceName((Autodesk.AutoCAD.DatabaseServices.BlockReference)dbObj, txtDeviceName.Text);
dbObj.XData = XData.ToXData(partCollection); t.Commit();}

The code for the ToXData function is here: 

public static ResultBuffer ToXData(PartCollection Parts) { //Write out some header information ResultBuffer rb = new ResultBuffer(new TypedValue(System.Convert.ToInt32(DxfCode.ExtendedDataRegAppName), XDATA_APP_NAME), new TypedValue(System.Convert.ToInt32(DxfCode.ExtendedDataInteger16), XDATA_TYPE), new [code].......

View 2 Replies View Related

AutoCAD .NET :: Selection Filter On Xdata For All Type Of Feature

Jan 6, 2010

I am trying to create selection set entity xdata(1001, 1000,1000) features like text,line,lwpolyline,insert....etc.

But its working only on linear features not working on remaining features, why?

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Select Objects With Given Xdata?

Jan 2, 2012

with a function like this I added some xdata, some MULTILEADER

(defun c:add_xdata () (princ "Select: ") (setq ogg (car (entsel))) (addXdata ogg "TEST" "CODICE" "1256") (addXdata ogg "TEST" "MATERIALE" "LEGNO") (addXdata ogg "TEST" "TIPO" "A"))
 
Now with the following function can only select leaders who have linked the xdata application TEST

(setq selez_all (ssget "X" '((0 . "MULTILEADER")(-3 ("TEST")))))
 
I can not, however, find a way to select all MULTILEADER who have a particular value of XData.

For example I would select all MULTILEADER with MATERIALE = "LEGNO" and TIPO = "A".

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Retrieving Xdata From An Entity?

Mar 29, 2012

How can i build a selection set of all circles  and then retrieve the xdata attached to them? 

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Reading Xdata Info?

Oct 14, 2013

Lisp code to read xdata information?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Remove Xdata From Layer Zero

Aug 14, 2012

I have a drawing that i know has xdata attached to layer zero. the problem is, it's not an object i can find. Any routine to remove xdata from ALL objects. like a global remove xdata?

View 6 Replies View Related

AutoCAD LT :: Use Excel 2010 Into Drawings To Set Up Tables - XData Handle Unknown

Jun 20, 2013

I have LT 2012.  I use Excel 2010 into my drawings to set up tables.  When I opened the drawing I've been working on, I had lost all of yesterday's data.  Command History shows dozens of these notations, "AcDbLine(41859) XData Handle Unknown, Null"   In Help it says you can no longer turn handles off, so it should be ON.  How can I point the drawing to my Excel data?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Reactor - How To Change Xdata Length If Line Is Modified

May 18, 2010

I need a Reactor to Modify Xdata - Length - contained in Line Object if this Line is modified (stretched, breaked, trimmed, etc).The routine need to verify if Line contain Xdata and modify it (and works with multiple selection).

I tried for long hours, but without success. I tried to create a list of entities while the reactor is applied, but doing so need another reactor to change these entities after the first Reactor works.The codes I used are below:

{code}
;If it just 1 string only you want to add
(defun add_xdata_str (e a v);;;EName APPID String_value
(and (not (tblsearch "APPID" a))
(regapp a))
(and (= (type e) 'ENAME)
[code]....

View 6 Replies View Related

AutoCAD .NET :: If Selected Entity Xdata Contains Value Then Select Additional Entity

May 22, 2013

I would like to add additional entities to the selection if any of the selected entities contains a an xdata value.

If I put the condition into the ImpliedSelectionChanged reactor I imagine will probably loop back on itself.

View 9 Replies View Related

AutoCAD 2013 :: Updating Block References Resets Block Table Selections?

Sep 4, 2012

We use a number of blocks with block tables for data extraction here, and whenever one of the blocks is modified and updated, all of the block tables reset to the default value. This happens for any block reference change, not just changes to the block table (which makes sense that it would reset).

How can we update these blocks without having to manually change all of the block tables afterwards?

View 2 Replies View Related

AutoCAD 2013 :: Dynamic Block In Action Doesn't Reflect Test Block

Jan 24, 2013

I am in the process of fixing one of our dynamic blocks. It's a fairly simple fix where there was a typo in one of the names of our items in the lookup that needed to be fixed.

I changed the name of the item in the lookup table. I went and did the test block and it seemed to work fine, but when I bring the block into a drawing, it reverts back to the old lookup as if I did nothing at all.

I made sure that the path was correct and I even just dragged and dropped straight from Windows Explorer to no avail.Does AutoCAD keep referring to the old block? Did I forget to change something else?

View 3 Replies View Related

AutoCAD Architecture :: Explode Destroys The Small Block Inside Bigger Block?

May 30, 2012

I have a block containing several parts blocks. When I explode the main block all of the parts are exploded back to lines. I have used both "explode" and "xplode" and have the same results.  How can I explode so I have my components as blocks?

View 6 Replies View Related

AutoCAD Civil 3D :: Inserting A Block Deletes Points With Point Style With Same Block

Oct 16, 2013

We're using C3D 2013 SP2.  The survey company we use uses point styles to show the blocks.  Say they shoot a catchbasin.  Instead of inserting the block, the point shows up as the block.

I did a field check & needed to insert a missed CB.  When I inserted the block, the other points that were CBs disappeared.  I had to insert the block, copy it the clipboard, undo the insertion & then paste the block in.  It did this on other drawings & other blocks.

View 7 Replies View Related

AutoCAD 2010 :: Inserting New Block And Entering Attribute Data By Selecting Another Block?

Aug 13, 2012

Is it possible, via whatever methods (lisp?) to be able to have a premade block with an attribute and insert it into a drawing then assign a value to it by selecting another existing block in the drawing and using one of its own attribute’s values?

For example, say I have a block representing a telephone and it had an attribute called "PhoneNo" and I inserted it into a drawing showing an office floor plan that had blocks in each office space that are telephone junction boxes with attributes "PhoneExtension".  I would like to be able to autocomplete the entering of the “PhoneNo” data by selecting one of the telephone junction boxes in the drawing and using its attribute’s value.

View 5 Replies View Related

AutoCAD 2010 :: Dynamic Block Grips - Block Does Not Change When Insert In Another File

Oct 28, 2013

I have created a dynamic block with a stretch, flip and rotate.  Everything works great in its file.  When I insert it in another file, the grips move but the block does not change.

AutoCAD 2014

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Removing Nested Block From Main Block?

Oct 3, 2013

I get an AutoCAD drawing from my conveyor manufacturer who have buried a block (tagname) in all of their conveyor blocks.

The only way to remove them is to manually use BEDIT and erase the tagname block.

Is there a way through Autolisp to search all blocks in a drawings and if the tagname block is part of the definition of the conveyor block, erase the tagname block or redefine the conveyor block without the tagname block.

View 8 Replies View Related

AutoCAD 2010 :: Convert Block Back To Title Block Or Border

Feb 15, 2012

We have a title block and border which is used in MS.  If this is referenced using AMTITLE then it acts as expected.  We issue these to some external people to create our drawings but they have been using CTRL-C and V to place them in a new drawing.  ACAD does now not see them as a Title block or border but as blocks.  We have a process to bring DWG's into SAP and this will check for a title block and border. 

The issue is we need to fix these drawings and currently this means removing the borders and title blocks and placing new ones then adding all the attributes again.  Is there a way to convert the blocks back to how they should be?
 
AutoCADM 2011 SP2
XP 32-Bit SP3

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Retrieving Block Name Of Anonymous Block

Mar 8, 2013

When dynamic blocks are inserted they're assigned an anonymous block name.  I'd like to be able to retrieve the name of the parent block after selecting the block on screen using AutoLisp.

Need a bit of code that handles this?

View 3 Replies View Related

AutoCAD 2013 :: New Block A Stretch Point Appears Even If Its Not A Dynamic Block

Dec 3, 2012

my problem is whenever i make a new block a stretch point appears even if its not a dynamic block . also its not a stretch point, because when i click on it, it just move the block , and it always appear on the coordinates 0,0 it cause me a problem when I insert the block , autocad use this point as a base point , and its very far from the real block .

View 1 Replies View Related

Revit :: How To Convert Existing 2D Autocad Title Block Into Block Template

Jul 24, 2008

How to convert existing 2d autocad title block into Revit title block template?

View 7 Replies View Related

AutoCAD LT :: Block Editor Saves Block But When Closing Says Changes Haven't Been Saved?

Mar 28, 2013

I have created a bock in ACAD 2011 LT. I then save the block using the command line or ribbon button then immediately try to close the block editor without moving or changing anything. A dialog appears saying the changes have not been saved to the block and would I like to save? If I say no don't save my changes and reopen the block the changes have in fact been saved. 

My question is there a way to get around this dialog box -Suppress it like FILEDIA = 0 for block editor or an option so it doesn't ask me to save. 

The goal is to do this all from the command line w/ out dialog boxes.

View 2 Replies View Related







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