AutoCAD .NET :: Insert Block Reference Using Block Name
Nov 17, 2012
Drawing contains a block with "BlkName". I want to insert blockreferences of this existing block using .Net. All shows how to insert a new block and then use the BlockID returned by the insert function. In my case I only have the block name and there is no Block id. How to get it or how to create a block reference of an existing block?
View 3 Replies
ADVERTISEMENT
Feb 26, 2012
I have a VBA code for check and choose unit but how i can in .NET ?
Unite = ThisDrawing.GetVariable("INSUNITS") Select Case Unite Case 4: Unite = 10 'mm Case 5: Unite = 1 'cm Case 6: Unite = 0.01 'm Case Else: Unite = 1 End Select
db.UnitMode is always = 0
i have try this :
Dim BlocT As BlockTable Dim tr As Transaction = db.TransactionManager.StartTransaction BlocT = tr.GetObject(db.BlockTableId, OpenMode.ForRead) Dim Bloc As BlockTableRecord Bloc = tr.GetObject(BlocT(BlockTableRecord.ModelSpace), OpenMode.ForRead) Dim lay As Layout = tr.GetObject(Bloc.LayoutId, OpenMode.ForRead) tr.Commit() tr.Dispose()
but bloc.units dont egal the unit command in autocad.
I can use :
Dim obj As Object = Application.GetSystemVariable("INSUNITS")
but i want a proper solution with .net.
View 1 Replies
View Related
Oct 21, 2013
I'm trying to change block the definition of an block reference.
I did something like this:
blockreference.BlockTableRecord = newBlock.ObjectId;
In most cases this works well. However I found a case that it not work as well. When I try to change the definition from a new block that I have created in my test DWG, it disappears from the model.
View 6 Replies
View Related
May 3, 2012
I have a block: “Block_A”. I am trying to determine if a block reference of the block exist.
Currently I would iterate every block Reference in the Block Table, and then dig deep into each block ref . . . . .
I was wondering if I could just take “Block_A” and see if it has reference and where the references are. Perhaps this is just wishful thinking but I was hoping for a faster way to obtain the references then to iterate thousands of blocks in each table record.
View 4 Replies
View Related
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
Apr 18, 2013
I am learning autolips and i found a problem that i can´t solved.
(vl-load-com)(defun c:pmb ( / ss ent pt )(prompt "
selec block : ")(setq ss (ssget '((0 . "INSERT")))) (setq ent (ssname ss 0)), (setq pt (cdr (assoc 10 (entget ent)))) (command "point" pt))
wich this code you select one block and insert one point at insert point´s block.
which this other code yo select all block and insert all point.... but in one block
(vl-load-com) (defun c:pmb11 ( / sele cod bloque nbloque lista pt ) (prompt "
block: ") (setq sele (ssget ( List'(0 . "INSERT"))) Cod 0 )cod (1+ cod) (repeat (sslength sele) (setq bloque (ssname sele cod)) (setq pt (cdr (assoc 10 ( entget bloque)))) (command "punto" pt) );repeat )
View 4 Replies
View Related
Nov 30, 2012
I have a block that i want to insert several times and revised each one to be different to do this i would have to insert it and rename the blocks that come in and then reinsert i would like to insert and have a lisp explode the main block and rename the other 2 blocks with a suffix at the end depending on how many times its in the drawing... can this even be done? My original block name that will be first inserted is "BENT PULLEY NOTES" it needs to explode after i drop it in and then there are 2 blocks within that called "Bent Pulley" and "Bent Pulley DYN" that i was hoping to keep the names but add a number at the end depending on how many are in the drawing already...
here is a lisp that i have found... it would work if i didn't have nested blocks and only wanted the one block to be insert and not explode...
(defun c:Test (/ e i name Bname )
(setq e nil)
(command "_.-insert" "Drawing1.dwg" pause "" "" "")
(if (setq e (entlast))
[Code] .......
View 9 Replies
View Related
Apr 11, 2013
I have a pallete button that inserts a block then a drag jig to position it. The block is first inserted at 0,0 and dragged.
The block at 0,0 remains visible while a "duplicate" block is dragged. Is there a way to hide the original?
Insert block then calling the drag jig..
AddViewBlock(New Point3d(0, 0, 0), 0, ColorIndex, trans) psr = ed.SelectLast() DragView(psr.Value, "Bar Insertion Point")
In the DragView procedure I have:
Public Sub DragView(ByVal SS As SelectionSet, ByVal sPrompt As String)
'....
Dim ppr As PromptPointResult = ed.Drag(SS, vbLf & sPrompt, New DragCallback(AddressOf MyDragCallback))
View 4 Replies
View Related
Apr 6, 2013
I am trying to insert a dynamic block and position and stretch the block, using the linear parameters, depending on values entered into a form.
I managed to create a form that would draw a series of boxes. And i managed to create a routine that would insert a block and size it depending on fixed values but i can't link the 2 together.
Win 7 Pro 64bit, Dell Precision M6500
View 8 Replies
View Related
Oct 20, 2007
I am using Autocad 2007 I made several blocks with att. And I use this drawing and copy it to the samples/design center folder so that I can see the blocks that I created on the Design center window for use on different other drawings.
My problem is that if I make a cange on the ORIGINAL block drawing how can I update the inserted blocks on the other drawings? I try to delete the block from the local drawing insert block list (is this possible?) to paste the block again with the new changes, but somehow even when I grab the new modified block to inserted again when I do it, it takes the shape of the old version!
View 6 Replies
View Related
Oct 26, 2012
Is it possible to create a block to insert on our title block that will populate itself with a list of drawings and names?
I know this is possible through the use of LISP and the Sheet Set Manager, but could this be done through a combination of attributes and fields (we want the same functionality in LT).
View 1 Replies
View Related
Apr 2, 2013
I write a program, this program needs to insert some standard illustrations. I made these standard illustrations into different blocks. And I store these blocks in a dwg file. Everytime I need to insert some illustrations, I just click the mouse on the current drawing, I want the illustration inserted. These means the following points:
(1) Import the blocks to the current drawing, if the blocks have already been imported, then do nothing.
(2) Specify the insert point by clicking the mouse, and I want the block's insert point to coincide with the mouse clicking point.
View 1 Replies
View Related
Mar 29, 2013
I need to get list of all block reference in a drawing without iterating through all entities in the drawing.
View 7 Replies
View Related
Jan 11, 2013
I have a weird problem with exploding block reference with vb.net as follows.
When I use BR.explode(DBObjectCollection), and append the entities in the object collection to model space,
the 3d Polylines inside the block reference do not get appended and I do not get any kind of error. The reason for this eludes me as of yet. (remember, simple polylines and lines and other objects do get appended to model space)
When I use BR.explodetoOwnerSpace(), the block reference explodes as it normally is expected to, but then I have no way to collect the objects from the exploded BR.
View 9 Replies
View Related
Sep 27, 2012
I'm working with two different drawings to import Layers for Lot Grading and when I'm importing the Block Reference from the origin file, it's setup as Linescale 0.5, but when I import into my regular basemap, which is setup for Linescale 1, the text size is double what it should be.
View 1 Replies
View Related
Oct 22, 2013
I'm trying to write a vb script to extract information from the CAD drawing. While testing, i found that for some drawing blocks, the corresponding AcadBlockReference Rotation returns 1.57, but when i look at the actual drawing, block properties, the rotation is 0.
View 3 Replies
View Related
May 11, 2010
i need to use something with similar effect to Editor's method SelectCrossingWindow, but i need it to select object in Block Reference. How can i do that?
View 5 Replies
View Related
Jul 13, 2012
I have a block reference in a dwg that is a like a form, for example:
Written By: Diogo
Author: Diogo
Date: 13-07-2012
State: Check-in
In autocad this is a block, and on the attributes of the block reference I only can edit State and Author, and i would like to get all values. Because i want to fill those values of Written By, Author, Date and State by code. I can reach the attribute collection of the block but i only can see the State and Author.
View 7 Replies
View Related
Jun 14, 2011
is ter any way to explode a reference block
View 4 Replies
View Related
Nov 29, 2012
I have a drawing with many block references on it and they have some attributes.
I know how to find the block reference witch the attribute value, and even change it but I don't know how to select it once I have the object ID of the block.
How can I do the selection without asking the user to select it?
View 6 Replies
View Related
Aug 2, 2013
I wonder if this can be done. i have a number of blocks which have labels to them i.e. JW1, JW2, JW3 etc. which corresponds to the block name. Is it possible to have the label automatically referenced to the block name so if i change the block name to JW10 the label within the block changes to JW10 as well.
View 4 Replies
View Related
Mar 21, 2013
I get a block reference (has attribute) from other drawing as code follow:
Public Sub GetBlock_Info() Dim blockName As String = "test" Try Dim doc As Document = Application.DocumentManager.MdiActiveDocument Dim doclock As DocumentLock = doc.LockDocument() Dim ed As Editor = doc.Editor Dim ofd As New OpenFileDialog("Select Drawing", Nothing, "dwg; dwt", "ATS detai drawing", Autodesk.AutoCAD.Windows.OpenFileDialog.OpenFileDialogFlags.DoNotTransferRemoteFiles) Dim dr As
[code]..........
View 9 Replies
View Related
Sep 9, 2013
i have a .dwg fille with some block reference.
I want to fill color for block reference, but when I debug to hatch.appendloop function, I get message eInvalidInput, and block don’t fill color.
This is my
[CommandMethod("FillColor")]
public void FillColor()
{
Document doc =
Application.DocumentManager.MdiActiveDocument;
Editor ed =
doc.Editor;
Database db =
HostApplicationServices.WorkingDatabase;
Transaction tr =
db.TransactionManager.StartTransaction();
[Code]....
View 1 Replies
View Related
Mar 7, 2010
I have an issue regarding nested entity.
I have a nested entity block reference. In this entity I have three blocks. if I change any of the block reference attribute definition in the nested block reference then it is changing the original block itself.
Actually I am getting the handle of the selected block reference in the nested Entity. and change the attribute reference later. but it is making change in the block itself and other block reference too.
Here is my
static public void CONTACTS()
{
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
string contactName = string.Empty;//to hold contact name, from xdata
[code].......
View 3 Replies
View Related
May 24, 2012
I have tried to use intersectwith to locate text (MText or DBText) near a block reference. Some times it works and some times it does not. The hard part for me is understanding why it occasionally works when most examples are just duplicates with modified text and attributes.
My block reference has 4 attributes to the left (Right Justified) of a circle and 2 attributes inside the circle. The text objects are used by some CAD operators instead of the upper 2 lines of attributtes. (Guess they dont know how to modify attributes) I want to locate these texts and insert text into the corresponding attribute.
Block Reference:
Att 1 |'''''''| <-- CAD User will insert a txt over Att 1 and Att 2,
Att 2 | | <-- both attributes are usally left blank or contain a space
Att 3 | |
Att 4 |.....|
View 8 Replies
View Related
Apr 5, 2012
I have text in my title block that references part properties. If I have several different part and assembly base views on a sheet, how do I control which one the title block references? It defaults to the first one that was placed. I am using 2011 Pro.
View 1 Replies
View Related
Sep 21, 2011
Is is possible to get the block handle from an attribute reference? I get the attribute reference from a previously stored attribute collection. I did try attref.BlockId.Handle.Value.ToString(), but it gives a different value, not the block's id.
View 2 Replies
View Related
Apr 23, 2013
I need to select a block in AutoCAD, and move it up or down vertically. I can get to the point where I have the user select a particular block, but after that, how do I get a reference to the block selected so I can move it up or down?
View 1 Replies
View Related
Feb 7, 2013
I have a block that I use as hatch (using superhatch), so the block appears several times. At the border of the hatch I want to fix some of the lines.
If I try to ungroup & explode the hatch, then the block appears outside of the hatch boundry.
So my question is if I can fix the lines so the hatch remains whole.
View 8 Replies
View Related
Dec 2, 2013
Is there a possibility to use "Dynamic Blocks" as an "External Reference" having the ability to use their features at the same time?
The thing is I have dwg1 and dwg2 files and in them I use "Dynamic Block1". Whenever I update "Dynamic Block1" in one of the dwg files I have to go to "design center" and update the "Dynamic Block1" in other dwg file.
View 9 Replies
View Related
Jul 26, 2013
AutoDesk 2014 . I am currently trying to design in iphone case. So I downloaded a replica iPhone from grab cad:
[URL]
I imported it and formed a solid around it, now I am trying to subtract the phone from the solid so it perfectly fits within the case. It will not let me subtract it though because the phone is a reference block and the square around it is a solid.
View 1 Replies
View Related