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:

'create the xline Dim cmdString As String = "._xline " & ptUcsOrigin.X & "," & ptUcsOrigin.Y & "," & ptUcsOrigin.Z & " " & ptUcsOrigin.X & "," & ptUcsOrigin.Y + 1.0 & "," & ptUcsOrigin.Z & " " acDoc.SendStringToExecute(cmdString, True, False, False)

 but i need to use the xline object after i've created it, so this sendstringtoexecute crap won't work. 

View 7 Replies


ADVERTISEMENT

AutoCAD Inventor :: Custom Title Block Position?

Jun 19, 2012

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

View 4 Replies View Related

AutoCAD Architecture :: Creating Custom Reference Keynote?

Jul 15, 2011

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?

View 1 Replies View Related

AutoCad :: Position Of Attributes On Block Match Position On Another Block

May 15, 2013

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 this even possible?

View 6 Replies View Related

AutoCAD 2010 :: Force Attribute Position To Remain Fixed In Drawing When Moving Block Position

Jul 12, 2013

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.

View 4 Replies View Related

AutoCAD .NET :: Insert Dynamic Block And Position And Stretch The Block?

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

AutoCAD .NET :: Error While Changing Block Definition Of An Block Reference

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

AutoCAD .NET :: Determine If A Block Reference Of The Block Exist

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

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 View Related

AutoCAD 2013 :: Create A Command For XLine?

Feb 13, 2013

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

View 9 Replies View Related

AutoCAD .NET :: Position A Block In Paperspace?

Nov 23, 2011

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. 

For what it's worth, here's my routine:

string dwgName = HostApplicationServices.Current.FindFile(comp, acadApp.DocumentManager.MdiActiveDocument.Database, FindFileHint.Default);
Database db1 = new Database(false, false);
db1.ReadDwgFile(dwgName, System.IO.FileShare.Read, true, "");
ObjectId BlkId;
BlkId = doc.Database.Insert(dwgName, db1, false);
BlockTable bt = (BlockTable)tr.GetObject(doc.Database.BlockTableId, OpenMode.ForRead, true);

[code]....

View 9 Replies View Related

AutoCAD .NET :: Retrieve Block And Its Position From DWG File

Jul 1, 2013

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?

View 5 Replies View Related

AutoCAD .NET :: Changing Position Of AttributeDefinition In A Block?

Dec 18, 2012

I am trying to change the position of an AttributeDefinition in a block, but it nothing is changed:

foreach (ObjectId oidAttribute in btrBlock){ adOrg = taTransaction.GetObject(oidAttribute, OpenMode.ForRead) as AttributeDefinition; if (adOrg != null) { adOrg.UpgradeOpen(); adOrg.Position = new Point3d(0, 0, 0); // Break; break; } adOrg = null;}
...
Commit();

How do I change the position?

View 4 Replies View Related

AutoCAD Inventor :: Creating A Composite Position Tolerance?

Nov 18, 2011

how to create a compsite position tolerance with the Feature Control Frame command? (See attachment)

View 2 Replies View Related

AutoCAD .NET :: Adding Custom Code In Reference Editing And RefEdit Command

Jun 6, 2012

how i can add .net code on reference editing and refedit command.

View 4 Replies View Related

AutoCAD Civil 3D :: Expressions Losing Custom Pipe Property Reference

Jun 28, 2012

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

View 4 Replies View Related

AutoCAD .NET :: How To Get All Block Reference In A Drawing

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

AutoCAD .NET :: Polyline 3Ds In Block Reference

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

AutoCAD Map 3D :: Block Reference Scale

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

AutoCAD VB :: Block Reference Rotation

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

AutoCAD .NET :: Selecting In Block Reference?

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

AutoCAD .NET :: Block Reference Attributes

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

AutoCad :: Explode A Reference Block?

Jun 14, 2011

is ter any way to explode a reference block

View 4 Replies View Related

AutoCAD 2010 :: Drawing XLINE - Command Locked Into Either Horizontal Or Vertical Mode

Jul 30, 2010

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.

View 5 Replies View Related

AutoCAD Inventor :: Use Custom Unfolding Rules With Angular Reference To Bending Angle

Aug 7, 2013

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 am working on 2012 SP 2

View 9 Replies View Related

AutoCAD .NET :: Select Block Reference By Attribute Value

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

AutoCAD 2013 :: Label Block Reference

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

AutoCAD .NET :: Get Block Reference Information Error

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

AutoCAD .NET :: How To Fill Color For Block Reference

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

AutoCAD .NET :: Change Block Reference Attribute

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

AutoCAD .NET :: How To Locate Text Near Block Reference

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







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