AutoCAD VB :: How To Edit Attributes In A Block At Insertion Time
Jan 31, 2013
I am inserting a block (strSectionBlk) into an AutoCAD 13 drawing using VB .NET. This block has an attribute with tag "FAB_HEIGHT" and I want to edit its string to the value of a variable "strFabHeight" at the time of the insertion of the block. The insertion of the block is fine but I've failed to edit the attibute.
Public Sub InsertSection()
'Call the Function that decides the name of the head section block strSectionBlk
getSectionDwg(strModel, strHeadType)
'Start the database
Dim db As Database
[code]....
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 am inserting a block that has one attribute with tag "FAB_HEIGHT". I have not been successful in editing this attribute.
Public Sub InsertSection() 'Call the Function that returns strSectionBlk (the Head Section drawing) getSectionDwg(strModel, strHeadType) 'Start the database Dim db As Database db = HostApplicationServices.WorkingDatabase() [Code] .....
I cannot edit any block attributes in my drawing. When attempting to do so, the command line states: "The object is on a locked layer". All of the layers in my drawing are unlocked, on and not frozen.
I have been using blocks for P&ID's for about 3 months now, and had no issues. But for some reason when insert a block now the attributes window does'nt pop up, so i can't edit the text ? The only way i have been able to get round this, is by using property inspector to edit the text
I got too smart for myself today in bringing an old drawing up to current standards...Everyone seems to want their block attributes to be zero - I have blocks where the attributes are best when they match the rotations of each blocks.
I have an old drawing that was rotated (as it should be) at approx 2deg.
I used a lisp routine to global edit all the blocks that needed to be at zero. BUT for some reason (and after hundreds of blocks were corrected), I noticed I now have two blocks that should NOT have been in the set have had their attributes rotated to zero....and the attributes should be at the same rotation as their block's rotation.
Because those two blocks have a fixed tic mark, I can click on the mark to see what the block rotation is, then rotate its attribute to that rotation, but I have hundreds of blocks! One-at-a-time sucks....
Any chance there is a GLOBAL way to edit an attribute rotation to match its own block's rotation?
my job is to make an editor for blocks in C#. There should be a WPF-window were the user can see a list of blocks. He selects one and than he should see an overview about block attributes like insertionpoint, basepoint, rotation and scaling and he should be able to edit these attributes in this form.
I know how i can populate a list of block names, but I fail at finding an opportunity to edit these attributes.
So a file sent to us was created in AutoCAD Map 2007 and we run AutoCAD MEP 2012 (and some on 2011). A Device ID Block was inserted in the Map program at 1:40 Annotative scale and was fine in their software, but when we load the files the attributes are enlarged to 40x their intended size. There are over 1,000 of these block in the plans and I've run out of solutions. I tried overwriting the block and it failed, and I also tried copying the oversized blocks into a file with the block predefined and that failed as well. At this point I am convinced I need to find or write a lisp for the repeated actions. I am crunching on the process for writing the lisp as I have written macros and VBA Functions for excel and understand the basic principles.
Create a routine that looks for a block based on a portion of that block name, using a specified path or search path.
For example, block to search for is BLOCKABC123, so if someone inputs ABC or 123 as a block name, it will locate that block within that folder and inserts it into the drawing at a user specified location.
Ideally, if there is a check in that if it finds more than one match, then perhaps it flags or prompts you to choose 1, 2, or 3 option which block to use. But I can live without this special function if it requires too much time to code.
If you insert a Unitless block into a drawing with the units set to mm or inches via the interface, AutoCAD will automatically take care of the scaling for you. By looking at the properties of a Unitless block after insertion it appears as though all CAD is doing is scaling the block in accordance with the units in the drawing.
How CAD is doing this calculation and how to get the same effect using the .NET API at the time of insertion?I could setup a function that examines the units of the block being inserted and the units of the drawing the block is being inserted into but how would i be sure i'm using the same conversion value as CAD?
e.g. I might decide 1 Unit = 0.0393 when i do the insert, whereas CAD might use 1 Unit = 0.03937007.
It would be nice to either use the same value or a function that the API provides that i'm not aware of to do the conversion
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've been using the admittedly pieced together code in order to insert border blocks around a closed polyline. Yhe problem I'm having is that when the Block angle is say "zero" the block is inserted the same way both on top and below the polyline. Since the blocks surround the polyline the blocks on the downside should have an additional 180 degree rotation. How to deduct that the portion of the polyline is in a certain quadrant and adjust the insertion angle as necc? I 'm not sure thats even the best approach.
Dim pso As PromptStringOptions = New PromptStringOptions("Enter name of block to create reference: ") Dim pr As PromptResult = myEd.GetString(pso) Dim blkName As String = pr.StringResult 'If (!bt.Has(blkName)) Then
I am using ACA 2009 and am experiencing something new with attributed blocks. When I insert the block, a copy of the block is placed at what seems to be an arbitrary distance away. As I fill in the boxes for each attribute, it appears in the image away from the insertion point. After I am done, the completed block appears filled out where it was inserted. I have never seen this before. Is there a setting affecting this?
I'm running AutoCAD LT 2011. As a test for myself when i first started using the program I created a block in which i have a rectangle and a linear stretch pair parameter attached to it, and a field attribute referencing the distance that the stretch parameter is stretched out to.
I'd like to know if its possible to set up a prompt when inserting the block into a drawing that allows me to type the desired distance of the stretch parameter and have the rectangle stretch to the entered distance as its inserted.
I'm trying to automate the process of simply inserting the block and then dragging the grips of the parameter out or updating the distance via the properties panel.
I have drawn some doors and saved them as blocks. Whenever I insert one or another, the door itself is far away from the insertion point. How can I modify this?
I have a polyline which consists of straight lines and curves in 2D enviroment.
I want to extract some coordinates. I usually use block refferences and "dataextraction" command. However, the problem is as follows:
I need to mark many things along the polyline's way at no constant intervals (not possible to "measure" it) If I have "osnap" on, I can't hit the spots I like for obvious reasons. If I have "osnap" off, I can't place the object accurately on polyline's way.
So, what I need is: how to allign multiple blocks to a said polyline. Allignment needs to be done as accurate as possible, prefferably perpendicularly to closest tangent of polyline.
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 simple block, I would like to do the following:
Type: Insert
Specify: Block Name
Click spot with cursor to have the block placed
Rotate the block for orientation
I know that if I use the Tool Pallets I can specify rotate on insert, but do not always want to use the Pallete. I also know I can assign a rotation parameter to the block so I can grip and rotate after insertion. Is there an easier way?
I create a block where coordinate 0,0 is my base/insertion point (which is established in an orientation that is to the lower-left of my blocks line work). In a new drawing I insert that block and specify coordinate 0,0 as my insert point. Instead of my insertion point being in the lower left it is in the upper right. I run into this in new version and old version drawings.
On my civil drafting project plate 1 I am trying to insert my Tree block and i type the coords in and it ends up way off screen but I insert a point at the same coords and it goes right where it needs to. What am I doing wrong?
Figured it out on my own by placing my tree on origin 0,0 and then creating block. not sure why that is the way it is but I got it to work for what I need it to do.
Have a number of std blocks with a single part number located centrally within a circle similar to std grid line coordinates used on architectural plans.
Is there a simple way to set the block up with its part number fixed centrally so that when the block is inserted at different rotation angles the part number always appears central within the circle and upright.
Forget lisp as only have LT.how to centralise the text within an attribute so its always central when block is rotated.
I've been working on several projects that require drafting in metric units and I'm having difficulty inserting block dwgs. into my working drawing at the correct scale.
My block drawing is set to millimeters. I've drawn my block and measured it. All is ok. UNITS = milimeters; INSUNITS = 4
My working drawing is in millimeters. All line work is dimensioning accurately. UNITS = milimeters; INSUNITS = 4
When I insert the block, it comes in extremely small. When I click on the block properties, it says it's units are in millimeters and the scale is 1. As it should be correct? except for the fact that its about 25x smaller then it should be. This leads me to believe there is an inch insertion factor some where.
To add to the conundrum, if I xref the block dwg into my working file, it comes in at the correct size. Is there an alternative block insertion scale factor setting that I'm not seeing?
We are having an issue while inserting blocks from the tool palette. Inserting a block from the tool palette takes about 5 seconds per block. Pick a block, wait 5 seconds, pick insertion point. Last week it took maybe 1 second. It doesn't sound like much, but we use alot of blocks everyday, and waiting 5 seconds every time gets annoying. Especially when it used to be almost instantaneous. We also have our blocks in our template. The template is on the server. If you type insert, and insert the block that way, it loads fast, like it used to using the tool palette.
Most of the blocks are simple text or shapes. None are dynamic. We also have some hatches in there, that are unaffected by the delay. They insert quickly.
Another thing has changed. The time it takes to change to a different tab on the palette has grown. A tab with about 10 blocks used to take about 6 seconds to load, now takes a good 30 seconds. And a tab with about 30 blocks that used to take about 12 seconds, now takes about a minute and a half! Once the tool palette and each tab has been opened for the first time, say first thing in the morning when cad is first opened, the delay is gone. They switch between tabs with no delays.
The only thing that I know of that has changed that coincides with this is last week we made a few changes to the template. We removed a few sheets that we no longer use. Could this have done something? The blocks are still in the template. We have 3 pc's that are affected in the same way, at the same time.
I've tried a few things to remedy this. I am by no means a cad guru. I created a .dwg with all the blocks in it. Made another tab on the tool palette using the blocks from the .dwg. Still the same delay. I tried creating a new palette using the design center and the blocks .dwg I made, but cad locks up on me and I have to restart cad. I tried that twice.
Whenever I insert a title block I get an "AutoCAD Error Aborting" message - FATAL ERROR: Unhandled Access Violation Reading 0x0040 Exception at d69ac126h.
The title blocks have been working fine for months in ACAD2012, and I've even tried saving the drawing containing the blocks as an AutoCAD 2013 dwg to no effect.
The title blocks are 'home-made' and contain a mix of fields and attributes, could this be causing the problem?