AutoCAD .NET :: Convert String To ObjectID

May 2, 2006

It is possible to convert an ObjectId into a string. But is it also possible to convert a string/int into an ObjectId?

I want to save some ObjectIDs to a text-file to use them later. But I haven't found something to convert them back.

View 7 Replies


ADVERTISEMENT

AutoCAD .NET :: Convert Entity Name To ObjectID?

Jan 3, 2012

I commonly send serialized data to .net functions.

One of the items I send in the entity name of something as a string.

Once my .net function is done, it constructs a resultbuffer to send back to lisp.

I had been doing this:

AcDb.ObjectId id = new ObjectId(Convert.ToInt32(ename));
 
but the Convert function is throwing an exception.

I do not recall this happening before, but forget if I ever tested it.

I am on win 7 64 bit.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Convert ObjectID To Handle

Jan 10, 2012

I wrote code for an application that stores links to lines and blocks in dictionaries using handles.  The routines work well and I can manipulate the data marvelously, but if one of the lines or blocks get erased the whole danged opera falls apart.  I knew this when I wrote the routines and have always been careful about using the ERASE command, as a matter of fact, I considered disabling it.

I am trying to make the package more robust.  I have been experimenting with attaching a reactor (:vlr-erased) to the objects which fires when the object is erased.  Unfortunately it fires before I can retrieve the handle of the object so that I can remove the references from the dictionaries.  The only thing that I can retrieve once ERASE fires is the ObjectID.  I can't seem to find a Visual Lisp routine to convert this value to a handle, does one exist?  Is there an ObjectID collection that has any references in it?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Convert To String ACL

Jun 6, 2012

I have a list that is "acl", I would like to convert it to a string "acl", everything that I have read uses alot of code. Does this  really take that much code to do?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Convert Every Element Of List To String

Jul 17, 2012

I have a list of (0 .4 .8 0 10). I want to convert every element of the list to string.

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Convert List With String Or Lists Of Strings To Text

May 22, 2013

Someday the light bulb is going off and I will understand mapcar and lambda. However.....I have a program that reads an excel file sheets. Sometimes the sheet only has 1 column, sometimes 2 or more.

I need to convert the saved values from the sheet to a list with the text spaced evenly. Unfortunately the text lengths vary. I would like a subroutine to pass the list to and return a list of strings with text aligned with padded spaces allowing for the longest text in each column. I am using the new list in a dialog box with fixed_width_font=true (so columns align).

Example 1-

(setq List1 (list "Col1-Line1" "Col1-Line2" "Col1-Line3-longer" "Col1-Line4"))
(AlignText List1)
returns
"Col1-Line1"
"Col1-Line2"
"Col1-Line3-longer"
"Col1-Line4"

so no padding needed

Example 2 -

(setq List2 (list (list "Col1-Line1" "Col1-Line2" "Col1-Line3-longer" "Col1-Line4") (list "Col2-Line1-longer" "Col2-Line2" "Col1-Line3" "Col2-Line4")))
(AlignText List1)
returns
"Col1-Line1        Col2-Line1-longer"
"Col1-Line2        Col2-Line2       "
"Col1-Line3-longer Col2-Line3      "
"Col1-Line4        Col2-Line4      "

 Example 3 -

(setq List3 (list (list "Col1-Line1" "Col1-Line2-longer" "Col1-Line3" "Col1-Line4") (list "Col2-Line1-longer" "Col2-Line2" "Col1-Line3" "Col2-Line4") (list "Col3-Line1-longer" "Col3-Line2" "Col1-Line3" "Col3-Line4")))
returns
"Col1-Line1        Col2-Line1-longer Col3-Line1-longer"
"Col1-Line2-longer Col2-Line2       Col3-Line2       "
"Col1-Line3-longer Col2-Line3      Col1-Line3       "
"Col1-Line4        Col2-Line4      Col3-Line4       "

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Changing String Of Text / Multitext / Dimensions To Another String

Nov 16, 2012

i failed to find one which would change string of a text to other for all types of objects. I mean it was usually either only multitext, or only text, dimensions or attributes.creating one which would change in abt 200 drawings:

-001

-002

-003

to:

-00001

-00002

-00003

in attributes, text, multittext, leaders, multileaders, dimensions..... at the same moment?

It is meant to be used in ScriptPro (by loading lisp in script).

If not possible, then can also open each file and run the lisp in each of them - still would save lot of time.

View 4 Replies View Related

AutoCAD Inventor :: Remove Iproperty Mass Unit String From Mass Value In Text String?

Oct 3, 2011

I've been looking for a solution to remove the unit string ie Lbs, g, kg from the value given from a 'Mass' value in a text string.

As you may all know, creating text and having a 'physical property - mass' value...the unit string is there...

Lots of people on here have the problem...no-one has got a solution.

Until now...

Basically...open the part you need to get the mass property of in your text string.

Follow the instructions on this webpage...this is the first part...

[URL]

Basically, this creates a Mass property value in the parameters table that you can call on as a text parameter.

It's similar to the custom iproperty model - mass but NOT the same.

Once you have done this, you can go to the drawing of the part and create a text string in the drawing and call it up as shown in this procedure. BUT it still has the unit string.

Here's the best bit that you want to know...

To get RID of the unit string...open up the part again from the drawing...click on the parameter icon...find the user parameter...in the Nominal value column, right click on the value and you get a pop-up that gives you 3 options...

Custom Property Format, Make Multi Value & Delete Parameter.

Click on Custom Property Format.

The pop-up window comes up...showing you the property type...in my case...the 4 left columns read Text, g (grams), Format & Precision...

On the right hand side I have a Preview of the text...then 3 check boxes...Units string, Leading Zero's, Trailing Zero's.

Units string is checked.

Uncheck it.

Close it...Save your part...go back to the drawing and hey presto!...the text now shows the weight you require as a straight value...no units!

View 9 Replies View Related

AutoCad 2D :: Edit One Text String And Same Change Can Affect Another Text String

Jan 12, 2011

I was wondering if there is a way that AutoCad can edit one text string and the same change can affect another text string, instead of editing the same thing twice.

View 9 Replies View Related

AutoCAD .NET :: How To Store ObjectID

May 31, 2012

I can store some ObjectId from my drawing to text file. After that how we can get back ObjectId from string read from that text file. Or have a diferrent way to store the ObjectID.

View 3 Replies View Related

AutoCAD .NET :: How To Select Object Via ObjectID Or Handle

Jul 29, 2011

Question,

I have a list of blocks in a datagrid. When i double click a certain record it gets the objectid or handle.

Now i know how too highlight the object. But i don't want to highlight the entity but select it so i can change it's property's in the property pallet.

In the first screen shot you see the code i have. wicht highligts the record but the propperty pallet display no object selected.

But i want it to work like the next picture.

So the question is. When i know an entity's objectid or handle how do i select that entity programticly.

View 2 Replies View Related

AutoCAD .NET :: Erase Hatch Using Polyline ObjectID

Aug 18, 2012

I have a drawing with a Polyline filled with Hatch. Also I have that Polyline ObjectId. So using this ployline ObjectId I want to erase the Hatch inside polyline. How I can erase the Hatch.

I'm developing the application using C#.

View 9 Replies View Related

AutoCAD .NET :: Cloned ObjectID Or Handle Using An Overrule

Aug 19, 2011

I need to use the Handle of the cloned object during a DeepClone override but AutoCAD shuts down when I try to use it.

This is the best I can think of but it still boots me out when I try.

Public Overrides Function DeepClone(ByVal dbObject As DBObject, ByVal ownerObject As DBObject, ByVal idMap As IdMapping, ByVal isPrimary As Boolean) As DBObject Try Return MyBase.DeepClone(dbObject, ownerObject, idMap, isPrimary) Catch Finally CompileCloneObjects(dbObject.Handle.ToString, MyBase.DeepClone(dbObject, ownerObject, idMap, isPrimary).Handle.ToString) End Try End Function

View 2 Replies View Related

AutoCAD .NET :: Obtain Certain Vertexes Via Polyline ObjectID?

Jul 31, 2011

I create a polyline ,and then add it's objectId to a ObjectIdCollection defined by me.After the polyline is created,I would like to obtain it's second and sixth vertexes via this polyline's objectId.

View 6 Replies View Related

AutoCAD .NET :: Have ObjectID Of Block Need To Retrieve Info

Sep 3, 2013

I have stored within an external database a handle of an entity within a drawing.  If I have that drawing open and I retrieve that handle and then get the ObjectID from that Handle how do I convert that to a BlockReference so that I can then get position and attrribute values.  I can get the position and attributes if I can just get the blockreference from the Object ID.

I am using the following code to get the ObjectID from the Handle:

Public Function ObjectIdFromHandle(db As Database, strHandle As String) As ObjectId Dim nHandle As Int32 = Int32.Parse(strHandle, Globalization.NumberStyles.AllowHexSpecifier) Dim handle As New Handle(nHandle) Dim ids(0) As ObjectId Try ids(0) = db.GetObjectId(False, handle, 0) Catch ex As Exception MsgBox(ex.Message.ToString, MsgBoxStyle.Exclamation, "Error in ObjectIDfromHandle") End Try Return ids(0) 'Return db.GetObjectId(False, handle, 0) End Function

I then want to use this ObjectID to get the BlockReference.

View 4 Replies View Related

AutoCAD .NET :: Create Object And Get ObjectID Or Add To Collection

Nov 8, 2012

I trying to create an autocad obbject eg: line. after creating i need to add object data to the created object.

unfortunately i am not able to get the objectid of the created object.

code snippet on how to do this..

1. creating a object and add the created object to collect or selectionset

2. get the object id or refernece so i can attach object dat relavent to the objedt...

View 5 Replies View Related

AutoCAD .NET :: ObjectClass Is Not A Member Of ObjectID (2008)

Mar 25, 2013

I need to make my application compatible with 2008 and have one error saying that ObjectClass is not a member of SubEntId (As ObjectID) in my InsertBlock routine.
 
Public Sub InsertBlock(ByVal blockname As String, ByVal trans As Transaction) Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database ' Test if block exists in the block table Dim bt As BlockTable =

[Code]....

View 9 Replies View Related

AutoCAD .NET :: Selecting Objects On Screen From Handle Or ObjectID

Feb 15, 2013

If I have a list of handles for Autocad Entities, how would I go about selecting these entities on screen so that the user could add to this selection or remove objects from the selection?  I could go with object ids as well if needed.

I have been searching and searching and coming up empty handed or at least coming up with information that doesn't seem to do what I want.

View 6 Replies View Related

AutoCAD Inventor :: String From DocumentTypeEnum In C++?

Jun 11, 2013

is there a function which returns the currently open document type as a string, something like this:

const char* const GetInventorDocTypeDesc(DocumentTypeEnum eDocTypeEnum);

View 2 Replies View Related

AutoCad 2D :: Get Coordinate String Of Polygon?

Jun 5, 2013

Possible to easily get a coordinate string of a polygon?

As in the coordinates of each of the vertexes within a polygon?

For example Easting1,Northing1,Easting2,Northing2, .... etc)

View 6 Replies View Related

AutoCad 2D :: Proper Way To String Dimensions

Oct 24, 2013

I'm currently having a debate within my drafting dept. as to which string of dims is more correct..

View 9 Replies View Related

AutoCAD .NET :: Find Layer Name Containing String Value?

Apr 15, 2011

I need to find layer names containing a specifing string value How do I cylcle through Layer names checking named string contents?

View 3 Replies View Related

AutoCAD .NET :: Custom Dimension Of Coordinate String

May 26, 2013

I want to custom dimensions about text of the coordinate in DWG. It should be like this:

I select a point then there displays a string of X,Y,Z coordinate of the point.

I select the second point to place a horizontal line(fixed lenth base the string font size)  and then the string.

the whole process is like radialDimension,but what I need is to describe the point x,y,z.

and the drawing should consist of start point(actually is the target point too) and end point and the line connects the two points and a horizontal line and a string.

I think this should be completed using Dimension Class(should be CoordinateDimension based Dimension).

give me some codes. Codes is better in C# of VS2010 for autoCAD2010.

Actually there is a simple solution for this. Using c# to draw two lines and a string. But this is really bad experience when I want to move the string.

View 6 Replies View Related

AutoCAD VB :: Insert Unicode Character Into String?

Feb 6, 2013

I need to insert a registered brand character (®) into a string for a product model using code ("Model Name ®"). How do you handle Unicode in VB .NET?

View 2 Replies View Related

AutoCAD .NET :: MText Formatting Codes To VB String

Oct 16, 2012

I am lifting mtext from a drawing and then working with the result.  For some reason the "\pxi-" at the beginning of the string I am lifting is converting to " pxi-" when worked with as a string in vb.net.  The result is this, when I apply the string back to mtext I get a bunch of messed up formatting codes at the beginning rather than a formatted piece of text.

This seems to be related to the "\" Is this automatically getting modified by vb or autocad when I pull the source text?

View 3 Replies View Related

AutoCAD .NET :: Attribute Reference Text String

Sep 4, 2013

I change a block's attributes programmatically using thisfunction I created:

private void UpdateAttributes(Database database, Detail det) { using (Transaction tr = database.TransactionManager.StartTransaction()) { //Grab the BlockReference the detail refers to. BlockReference block = (BlockReference)tr.GetObject(det.ObjectId, OpenMode.ForRead); //Iterate over the Attribute ids. foreach (ObjectId [code].......

You can ignore the Detail and Detail Attribute objects as they are also user-defined.  Also note that this function expects the database to be currently open for working on.

Everything in this function works fine, but there is a strange quirk that becomes noticeable only when I use this function to edit an attribute that has its "Invisible" property set to "No".

Below, is the original block that is edited via this function:

As you can see, the block has a number with 4 digits (for our purposes, call this the Block Number).

View 6 Replies View Related

AutoCAD Map 3D :: Converting Text String To Block

Aug 16, 2012

In a drawing, i have several text strings, 's', that i would like to change to a known block... is this able to be done? there are over 3000 's' in the drawing, hoping to change them all to the same block. let me know if this can be done.

View 2 Replies View Related

AutoCAD VB :: String Extraction / Modify Commands Using VB?

Sep 3, 2013

I want to extract 3 different variable strings based on one large string such as:

"2013_ARCH-Lev01.dwg"       <or "2014_STRC-Lev00-BM">

and the 3 variables are:

Dim YEAR As String
Dim TRADE As String
Dim LEVEL As String
YEAR = 2013                           <or 2014>
TRADE = ARCH                        <or STRC>
LEVEL = 01                              <or 00-BM>

I was thinking of using the first four digits "(0,1,2,3)" for YEAR?

using the next four digits following the underscore "_(0,1,2,3)" for TRADE?

using the rest of the digits following the dash "-(unknown)" for LEVEL?

View 1 Replies View Related

AutoCad 2D :: Converting Text String To Known Block

Aug 16, 2012

in a drawing, i have several text strings, 's', that i would like to change to a known block... is this able to be done? there are over 3000 's' in the drawing, hoping to change them all to the same block.

View 9 Replies View Related

AutoCAD .NET :: Possible To Store String Array To XRecord

Jul 22, 2011

Is it possible to store a String Array to an XRecord?

View 1 Replies View Related

AutoCad :: Keep Original String In Text Override?

Aug 15, 2011

I know it is easy to enter special characters in using “%%” escape sequence. However, if I am not entering in single or multiline text, but rather in a dimension annotation’s “override” field, I found that the newly entered text completely overrides the original dimensional annotation.

For example, if originally I had a diameter of 7.98, and I would like to put a Φ sign in front of it to make Φ7.98, but it seems that there is no way to preserve the original content of 7.98 together with the Φ sign.

Is it possible to keep the original measurement within the string? What is the special character representing the original measurement?

View 5 Replies View Related







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