AutoCAD .NET :: Creating Xline From Block Reference Position In Custom UCS
Mar 14, 2013
i'm looking to select a block reference, take it's wcs position, translate the coordinates to the current ucs and then create an xline using those translated coordinates. simple, right?
i simplified some code to test that i could properly build an xline in a current ucs. i just threw in static point3d values instead of grabbing them from another object. it worked as expected:
<CommandMethod("test")> _ Public Sub test() 'get the active document, editor and database Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument Dim acDocEd As Editor = acDoc.Editor Dim acCurDb As Database = acDoc.Database 'start a transaction Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction() 'open the table for read Dim acBlkTbl As BlockTable acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) 'open the record for write Dim acBlkTblRec As BlockTableRecord acBlkTblRec =
[code]...
here, i revised the code so that a block reference's objectid is passed from another procedure, the origin is determined, translated to the current ucs and the points are tailored for the xline's basepoint and secondpoint. i threw in a few writemessages to ensure that the coordinates were indeed what i was looking for and they match up, but for some reason, the xline now fails to create itself.
'define the current ucs Dim ucsDesign As Matrix3d = acDocEd.CurrentUserCoordinateSystem 'start a transaction Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction() 'open the connector block for read Dim acBlock As BlockReference = acTrans.GetObject(idConnector, OpenMode.ForRead) 'save connector origin Dim ptOrigin As Point3d = acBlock.Position 'translate the point to the current ucs Dim ptUcsOrigin As Point3d = ptOrigin.TransformBy(ucsDesign.Inverse) 'show me the block position acDocEd.WriteMessage(vbLf & ptOrigin.ToString()) acDocEd.WriteMessage(vbLf & ptUcsOrigin.ToString()) 'open the table for read Dim acBlkTbl As BlockTable acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) 'open
[code]...
i've rearranged this code multiple times, tried a couple different approaches, scoured the forums and even resorted to the less-than-elegant:
I have created a custom title block and border for one of the automotive manufacturers since I need to submit all their drawings in the standard border and title block format. The border is quite broad, so when I insert the new title block, it overlaps the border slightly. I need to try and find the setting to control the exact point at which the title block is positioned when inserted into a drawing.
Windows 7 Pro (X64) Intel(R) core (TM) i7-2600 CPU @ 3.40GHz 16.0 GB RAM Nvidia Quadro 600 Autodesk Inventor 2013 Professional Ultimate Design Suite
I have not had any luck finding support on Auto Cad Architectures Keynoting w/ data base.
The issues I can't seem to resolve are: formatting the reference legend and saviing the format so I can re-use it in all my drawings creating a custom reference keynote?
Is there an easy way to ensure that the position of attributes on a block match the position on another block?
I just used the ATTIN command to upload a bunch of data to the block attributes on a drawing, and now the information is all over the place.
Instead of going through each one manually and repositioning the attributes (a VERY lengthy process), I want to use a "correct" version as a template of sorts to inform the other selected blocks of where to place the attributes and have it reposition the whole thing automatically.
Is it possible to setup a block so that an attribute position remaines fixed (absolute to drawing) when moving the block?
I've been playing around with creating a Coordinate Block by following these instructions: [URL] ........
What I would like is to be able to set the position of the Coordinate Label and Coordinate Object independently, so that if I move one in the drawing, it doesn't move the other. I've looked into Dynamic Blocks, and the "Lock Position" parameter. I can move the attribute independently, but still everytime I move the block, the attribute moves too.
Our company uses a custom Sheet/Coordinate system to follow flyoffs across a drawing, and I'm trying to learn how to automate the process. It's completely manually right now, so any changes to a drawing creates a lot of work renumbering these flyoffs.
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.
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.
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.
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?
I wanna create a command to put in the LISP file. Bascially when I type XV or XH a vertical or horizontal xline will be created and automaticlly put on defpoints layer.
My former office had this and it was very slick and was wondering if I could ad it to my new office
I've worked on a command that automatically imports a dwg into paperspace and positions it. I've just realized that when imported vertically, the titleblock is on the wrong side of the layout. I've imported it to (10,10,0) and would like to import to those exact opposite co-ordinates to essentially flip it but i'm a bit unclear as to how. I know that I can use the commands Database.PextMax and Database.PextMin to determine the max and min points of the primary layout, but what co-ordinates are these, are they the top right corner and bottom right corner.
How can I retrieve a block from DWG file using Objectarx SDK.Lets say I have a cinema hall design with a lot of chairs and I am using a blcok named chair to design it. Now I want to retrive this blocks and their positions. Is it possible?
Having problems using custom pipe properties in pipe label expressions in 2013? I have some expressions relating to stub callouts and the ones that directly reference the custom properties lose that reference every so often.
For example I have and expression called "STUB-Riser-Length2d" which is defined as "{Riser Length} / SQRT(2)" where "Riser Length" is the custom pipe property. Every week or so it changes to "/ SQRT(2)".
I haven't been able to find the pattern as to exactly when this happens yet. All expressions not referencing custom properties seem to be holding steady. The pipe catalog is on a shared drive on the network, if that makes any difference.
Civil 3D 2013 - Windows 7 Pro 64 - Dell T3500 - Xeon 2.67 - 24gb - Quadro 600
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.
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.
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.
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?
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.
this in an issue ive noticed for a long time now across a few versions of ACAD, not sure whats causing it. When i try to draw an XLINE sometimes the command will get locked into either horizontal or vertical mode, without me choosing that option. seems to based on the OSNAP pickpoint i grab maybe.
attached are pics of the process.
i run XLINE, pick endpoint and bam, its locked into horizontal mode, very annoying if im trying to make a vertical and horizontal line based off the same point.
I want to use the custom unfolding rules using Bend Compensation with an angular reference to the bending angle.
I have an Excel sheet where I have determined the bend allowance, the set back and from that, the bend compensation. When I compare these values to the values I get when using a K-factor linear unfolding method in Inventor, I get almost exactly the same results.
Tells me the formulas are working. So I implement the formulas in the custom equations. Exactly the same as in the Excel sheet. 10 degrees angle, great results! Yeah! 45 degrees, great results! More yeah! 90 Degrees, still going strong, I think I might make it!
100 degrees.... Fail! Every time an angle goes over 90 degrees, the result is crap.
I have been struggling with this all day long!! So in the end I completely erased the equations from the Inventor custom equations.I just say: Compensation is 1 mm. For all angles. This should no room for interpretation.
Again I try. I have a sheet metal part with two legs. A 100mm leg and a 50mm leg. Flat pattern should always be 151mm. Period.
Again, under 90 degrees and on 90 degrees, I get nice flat patterns. Above 90 degrees, it fails again.
Am I completely overlooking something obvious?? Or is Inventor really bugging on this?
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?
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.
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]..........
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].......
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 |.....|