AutoCAD .NET :: Update Field Data - Redefine Block Attributes
Jul 7, 2011
I've got a block with multiple attributes. This is not a problem to redefine the blocks attributes.
Some of the attributes contains dynamic fields (blockplace holder x y z parameters) When i insert a block with such atributes that includes the blockplaceholder dynamic fields i get
X: InsertionPoint => It is recognized as an Dynamic field but displays InsertionPoint. and does not update the value.
How can i update the fielddata from vb.net?
Part of the code I use (where i think the problem is)
For Each attid As ObjectId In refbtr attent = tr.GetObject(attid, OpenMode.ForRead) If TypeOf attent Is AttributeDefinition Then Dim attdef As AttributeDefinition = attent Dim attref As New AttributeReference() attref.SetAttributeFromBlock(attdef, myBlockRef.BlockTransform) Dim attrefid As ObjectId = myBlockRef.AttributeCollection.AppendAttribute(attref) tr.AddNewlyCreatedDBObject(attref, True) End IfNext
I'm working with some "dirty" blocks that contain several attributes. I've cleaned the blocks up by wblocking, cleaning, & purging the newly created block. I also removed any attributes within the file, including those within blocks within the file. I then renamed the file and inserted it into the drawing, and did a replace block with another through express tools. The problem that I have is the blocks are replaced with the clean version, yet the attributes remain. Is there a solution to this. I do not want any attributes to remain and the only way I know how to fix it is to replace them one at a time.
I would like to change sub block from a visibility after setting it. Here an example of code to get the right visibility, I don't really know how to update a sub block by name or by handle(seems to change inside dynamic block).
Dim Block As AcadBlock Dim BlockRef As AcadBlockReference Dim DynEntBlock As AcadEntity Dim DynObjRefH As IAcadBlockReference [Code]........
I have a couple of attributes suing fields within a block. But they don't update on opening. I need to do a manual field update to get them updated to the latest values.Tried various combinations of "fieldeval", but this was no good.
I have some soil boring data captured, in the field, to an Excel spreadsheet; basically, a bore site ID and coordinates.
I'd like to be able to have the coordinate attributes of blocks inserted into my bore site plans populate automatically, perhaps based off of the value of a bore site ID attribute which is manually entered for each bore site.
Alternatively, if there were a way to insert the bore site blocks based off the actual Excel records, populating all attributes and locating the block by the actual X,Y,Z coordinate, that might be even better.
I have a basic floor plan in AutoCAD 2012 that has blocks in specific locations which contain personel data....name, phone, computer tag, desk key numbers, etc. I extracted the data to an Excel spreadsheet and I thought set up a "data link". But I don't know how to make the data update.
My problem...moves of staff, phone, computers are often made, but no one lets me know about it until they want a new floor plan printed and the computer and key tags get so messed up from the moves that it can take me hours to fix.
My goal is to be able to have our secretarial staff update the spreadsheet and in turn update the blocks in my AutoCAD drawing when it is opened and/or "updated".
I want to make a price list, using attributes in block and then extracting them to cell matching some cells with excel
While in data extr wizard for some reason I cant get the size column to set in ascending order.. Why does size 10 brake the logic?
Can I edit the extracted data without launching data extr wizard?
Data extr wizard brings a data in one table what if I want the table to display other types of attribute ( example see pic for instance instead of EL i have SS no problem until now, but my matched data link in excel is for EL and not for SS)
Its hard to explain Basicly i selected the column in excel for one type of attribute "EL" and I want fo a different name of same attribute different cell matching.
Running a Query that inserts a block with attributes filled with text derived from a file that has a large set of polylines with object data (text)? Is it easier just to insert this object data as text with a query. Or can I place this object data (text) into a block that inserts?
Example:
- You have land locations defined within the object data assigned to a set of closed polylines. (Large subdivision) - Field name for object data on each closed polyline is "LAND_LOC" - Now, I'd like to label these locations with a block that inserts to a central point within the closed polyline. - Block Attributes with "get" the information from the polyline / object data and place this value in the block attribute. - I have 1 drawing file that has closed polylines with object data assigned to them. - What is the best method for this? I'd like a block with attributes to insert and pull the object data / field and place it into the block with a defined attribute, that is central to each of the closed polylines. (LAND_LOC)
Is there a way to have a block (called test, for arguments sake) within this block we have text (attribute / fiield or whatever).
Now I have an alignment that has stations set every 10 units and on those stations I have inserted the block "test" as part of the alignment label style.
I can get the block inserting correctly, rotation the direction I require etc but what I need is for this block to report the station number.. ie 10, for the first 20 for the second and so on.
how I can get VBA to insert/redefine a block reference from another file into a block (of the same name) that already exists in the target drawing?
I've tried using the insertblock method but it produces a 'filer error' - As a bonus point, it'd would also be good to be able to retrieve the contents of the blocks collection in the source drawing in some clever way other than opening it (a bit like browsing using the design centre) ?
ACad, MEP, 3DS Max Windows 7x64 X5482 @3.2Ghz 8Gb Ram Quadro FX1700
I have a drawing with multiple instances of a dynamic block. I have a second drawing with said block modified.
I want the first drawing's block to be updated to the modified block without reinserting each block separately.
I don't have the block as a separate file to "insert", only available to copy. With it being dynamic, I don't trust using the block editor and just copy/paste from the modified into the original.
say you make some parcels in your project with custom data fields like: id_no, permit_no, acres_served etc. you attach an agency provided shape file via an fdo connection that has many fields of information like above.
when you right click on your parcel and do parcel properties you get a tab that lets you input the custom parcel data.
lets say you print an fdo map label showing, say, the id_no, provided in the shape file. Then in your custom parcel properties for id_no you type that in.
is there a way to make an expression to put in the other custom parcel properties that will read, say, the permit_no(id_no) from the fdo like and put that information in the custom parcel property field?
I'm trying to insert a block, wich contains 2 nested blocks:
1 dynamic block 1 annotive block which has a scale 1:200 with an attribute.
when i'm inserting it trough the toolpalette, and my annoscale is 1:100, the annotive block is converted to the annotive scale 1:100, instead of the 1:200 wich it originally is.
I can't set the annotationscale in the toolpallete, exept when i use macro's. but this also has a drawback.
when i'm inserting the block with a macro, i have to insert a complete drawing wich contains only this one block.This block contains dynamic parameters (i can't add dynamic parameters outside of the blockeditor)
When this block (dwg) is inserted, i explode the block so it becomes the dynamic block again. but the block cannot be redefined, because the actual inserted block is a dwg file.
Is it a drawback of the use of the toolpalette and dynamic / annotive blocks?
I am trying to redefine Block A to Block B, Block C & Block D based off the value of an Attribute in Block A.
If the Attribute in Block A is "1" then redefine to Block B If the Attribute in Block A is "2" then redefine to Block C If the Attribute in Block A is "3" then redefine to Block D
I know it should be able to be done using If and Cond functions within a lisp routine, but I am in a hurry with it and don't have the time to research it anymore.
I have the following code to redefine a block after a command has ended:
(vl-load-com);*********************************************************(defun Redefine() (command "_.INSERT" "reactortest=reactortest" nil)(princ "Block redefined."));****************************************(vlr-command-reactor nil '((:vlr-commandEnded . endCommand)));******************************************************(defun endCommand (calling-reactor endcommandInfo / thecommandend) ; Get the name of the command.(setq thecommandend (nth 0 endcommandInfo)); Check name of the command.(cond ((= thecommandend "PLINE") (Redefine)));cond(princ));defun(princ)
It doesn't work because INSERT is an interactive function and can't be called while a reactor is active. Is there another way to redefine a block that can be used in a reactor? The block is in one of the default search path's.
I am a little new to assigning attributes. My company had a block with two attributes that I need to alter. When the block is inserted, it asks a quantity. The other attribute is titled location. I am told if needed, all these quantities can be totaled per drawing. It has a title of "location". Two things: How to replicate this action? And is there a way to show all properties of a field for an attribute?
Without using scripts, is there any way to have rectangles or textboxes act on values coming from a data file? For examplle if the value in a textbox was greater than 10 coming from a data record, could the textbox change color, or any other attribute to make it change from record to recortd as it is being viewed or printed?
Is there a way to create a block with attributtes that automatically complete x, y, z, lat, long for the insertion point of the block?
I am trying to complete text in paperspace that will automatically fill in the lat long of a point in model space without using a table. I have tried field insertion with reference to a cogo point, but it doesn't give options for position on a cogo point. If I pick a block with attributes, it will let me pick any attributes, and x,y position for the block.
Cogo points show all the information I need to propagate in the properties....but how do I get that to translate into the text using fields or some other method?
Dell Precision T3600 - Windows 7 64-bit NVIDIA Quadro 600 Intel(R) Xenon(R) CPU E5-1607 0 @ 3.00GHz 3.00GHz 8 GB ram - Two 1TB raid
I'm using ACA2012 x64 but I suppose this question is applicable to all flavors of AutoCAD. Is there a routine that will insert today's date in a drawing and update that entry when the drawing is opened? Fieldeval won't update date fields.
I am having problems with the automatic field updates. I've made a dynamic block with a length parameter "LENGTE (mm)" and a stretch action. In this block I also made a Attribute "LENGTE" the value of this attribute is linked to the length of the parameter with a field. The system variable "FIELDEVAL" is 31, so when I save or plot, or ..., the value of the attribute will be updated to the exact length of the parameter.
Now when I insert the block and stretch the parameter to a desired length and I save the drawing the attribute is updated and it has the same value as the parameter. But when I close the drawing and I open it again AutoCAD changes this value to ###. I tried the command "UPDATEFIELD" but the value doesn't come back. I have made a command string "c^c^_fieldeval;0;0;save;close" so that when i close the drawing AutoCAD sets the system variable FIELDEVAL to 0 then saves it and closes the drawing, so when I open the drawing again AutoCAD doesn't update the fields. That solved the problem. When I open the drawing again, I made a command to put the fieldeval back to the default value "31", so when I change the length parameter the attribute "LENGTE" will be updated again after a save or a plot. But then it goes wrong and AutoCAD changes the value back in ###. What is the reason that AutoCAD can't update that field, it works fine when the drawing stays open but when the drawing has been closed and I open it again it doesn't work anymore?
I can insert a block with block attributes using the Inter op very easily:
Dim theBlock AsAcadBlockReference Dim pickScreenVBA = myDoc.Utility.GetPoint(, "insert the hydrant") theBlock = myDoc.ModelSpace.InsertBlock(pickScreenVBA, "Hydrant", 1.0#, 1.0#, 1.0#, 0) Dim varAttributes AsObject varAttributes = theBlock.GetAttributes varAttributes(0).TextString ="3 Ports" varAttributes(1).TextString ="Salt water"
Works great, but when I try using the non-inter op, all the example insert new Attributes and not add block with existing attribute (so I end up with duplicate attributes for each block - i.e "Salt water" attribute is added to the block each time I run the code),
Are they any examples that does the same as above using the non-interop code?
I'm trying to add some attributes to an existing block using the block editor, but after I save and close it I cannot see any 'placeholders' despite adding a default value and the attributes work fine when I double click the block.
I've tried using the ATTSYNC and BATTMAN commands but nothing works and there are no invisibility states applied to either the attribute or block and all layers are switched on.
I just tried making a quick block from scratch and it seems to have the same affect, except the default value will show, but no 'placeholder' shown if left blank.
I swear with previous version I could see the tag when a value hadn't been applied, so is it that the version I now use (2012) does not have this feature or it's disabled?
I have a field in a block and all the FIELDEVAL variables are set as shown in the screenshot but the field doesn't update on REGEN - I have to issue the UPDATEFIELD command to update the field.
There was a previous thread started in March 2011 with the same problem - is this another unresolved bug? (No connection with Autodesk other than using the products in the real world)
IDSP Premium 2014 (mainly Civil 3D 2014 UKIE SP1 & Infraworks with some limited 3ds Max Design) Win 7 Pro x64, 256Gb SSD, 300Gb 15,000 rpm HDD 16Gb Ram Intel Xeon CPU E5-1607 0 @ 3.00GHz (4 CPUs), ~3.0GHz NVIDIA Quadro 4000, Dual 27" Monitor, Dell T3600