.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Obtain point coordinates froma dwg file through .net

25 REPLIES 25
Reply
Message 1 of 26
ethiel
636 Views, 25 Replies

Obtain point coordinates froma dwg file through .net

Good afternoon.

¿it can be possible to get point coordinates or line coordinates from a dwg file using .net language?.

Im spanish, please, sorry for my poor english.
25 REPLIES 25
Message 2 of 26
BillZndl
in reply to: ethiel

Can be used for most entities:


http://through-the-interface.typepad.com/through_the_interface/2007/02/using_the_com_i.html



Bill
Message 3 of 26
Anonymous
in reply to: ethiel


si.

 

{code}



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">[
style="COLOR: #2b91af">CommandMethod
(
style="COLOR: #a31515">"test"
)]



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">public

style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="COLOR: blue">static
void
blah()



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">{



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">   

style="COLOR: #2b91af">ObjectId
[] ids =
PointSelectionSet();



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">   

style="COLOR: blue">if
(ids == null)
return;



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">

 



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">   

style="COLOR: #2b91af">Document
doc =



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">       

style="COLOR: #2b91af">Application
.DocumentManager.MdiActiveDocument;



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">

 



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">   

style="COLOR: blue">using
(
style="COLOR: #2b91af">Transaction
tr =
doc.TransactionManager.StartTransaction())



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">   
{



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">       
foreach (
style="COLOR: #2b91af">ObjectId
id in
ids)



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">       
{



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">           
Entity e = (
style="COLOR: #2b91af">Entity
)tr.GetObject(id,
style="COLOR: #2b91af">OpenMode
.ForRead);



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">           
if (!(e
style="COLOR: blue">is

style="COLOR: #2b91af">DBPoint
))



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">               
continue;
style="COLOR: green">//shouldn't happen with
filter.



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">

 



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">           
DBPoint p = (
style="COLOR: #2b91af">DBPoint
)e;



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">           
//check out p.Position; p.X;
...



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">           
//if you don't need the entity for
testing.



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">           
//DBPoint p =



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">           
//(DBPoint)(Entity)tr.GetObject(id,
OpenMode.ForRead);



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">       
}



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">   
}



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">}



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">

 



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">public

style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="COLOR: blue">static
ObjectId[]
PointSelectionSet()



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">{



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">   

style="COLOR: #2b91af">Editor
ed =



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">       

style="COLOR: #2b91af">Application
.DocumentManager.MdiActiveDocument.Editor;



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">

 



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">   

style="COLOR: #2b91af">PromptSelectionResult
psr;



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">   

style="COLOR: #2b91af">SelectionFilter
sf =



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">       
new
style="COLOR: #2b91af">SelectionFilter



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">           
( new
style="COLOR: #2b91af">TypedValue
[]



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">            
{ new
style="COLOR: #2b91af">TypedValue
( (
style="COLOR: blue">int
)
style="COLOR: #2b91af">DxfCode
.Start,
style="COLOR: #a31515">"POINT"
) } );



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">

 



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">   
psr =
ed.SelectAll(sf);



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">

 



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">   

style="COLOR: blue">return
psr.Value !=
style="COLOR: blue">null
?



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">
style="mso-spacerun: yes">       
psr.Value.GetObjectIds() :
style="COLOR: blue">null
;



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">

 



style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">}


{code}


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Good
afternoon. ¿it can be possible to get point coordinates or line coordinates
from a dwg file using .net language?. Im spanish, please, sorry for my poor
english.
Message 4 of 26
BillZndl
in reply to: ethiel

Paul,
I'm on the web side and what you just posted looks like the source code for an html page.
Unreadable here.

Bill
Message 5 of 26
Anonymous
in reply to: ethiel


Thanks Bill - looks great on the newsreader side.
I wish they fix this mess - I just don't get it. I won't even
read

most posts any longer as they are unreadable on the
newreader end... Here is a txt file.

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Paul,
I'm on the web side and what you just posted looks like the source code for an
html page. Unreadable here. Bill
Message 6 of 26
BillZndl
in reply to: ethiel

Thanks Paul,

I wish I could be on the newsreader side (not allowed here at work).

I'm spending less time here to as searches are almost worthless (why waste the time?).

Bill
Message 7 of 26
Anonymous
in reply to: ethiel


They even grabled the txt file... Looks fine here
but if I download the txt I posted it's all on two lines.
wtf!~

Does this look any better?

 

[code]



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">[CommandMethod("test")]
public
static void blah()
{
    ObjectId[] ids =
PointSelectionSet();
    if (ids == null) return;



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">   
Document doc =
       
Application.DocumentManager.MdiActiveDocument;



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">   
using (Transaction tr =
doc.TransactionManager.StartTransaction())
   
{
        foreach (ObjectId id in
ids)
       
{
            Entity e
= (Entity)tr.GetObject(id,
OpenMode.ForRead);
           
if (!(e is
DBPoint))
               
continue; //shouldn't happen with filter.



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">           
DBPoint p =
(DBPoint)e;
           
//check out p.Position; p.X;
...
            //if
you don't need the entity for
testing.
           
//DBPoint p =

           
//(DBPoint)(Entity)tr.GetObject(id,
OpenMode.ForRead);
       
}
    }
}



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">public
static ObjectId[] PointSelectionSet()
{
    Editor ed
=
       
Application.DocumentManager.MdiActiveDocument.Editor;



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">   
PromptSelectionResult psr;
    SelectionFilter sf
=
        new
SelectionFilter
           
( new TypedValue[]

             {
new TypedValue( (int)DxfCode.Start, "POINT") } );



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">   
psr = ed.SelectAll(sf);



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">   
return psr.Value != null ?
       
psr.Value.GetObjectIds() : null;



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">}


[/code]

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"Paul Richardson" <prichardson<lastpoint> wrote in message
href="news:6092539@discussion.autodesk.com">news:6092539@discussion.autodesk.com
...


Thanks Bill - looks great on the newsreader side.
I wish they fix this mess - I just don't get it. I won't even
read

most posts any longer as they are unreadable on
the newreader end... Here is a txt file.

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Paul,
I'm on the web side and what you just posted looks like the source code for
an html page. Unreadable here.
Bill
Message 8 of 26
Anonymous
in reply to: ethiel


this one looks good in the newsreader also
- but I see it not great in the web browser... How about an image -
lets

see if they can mess this one up...~)

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"Paul Richardson" <prichardson<lastpoint> wrote in message
href="news:6092584@discussion.autodesk.com">news:6092584@discussion.autodesk.com
...


They even grabled the txt file... Looks fine here
but if I download the txt I posted it's all on two lines.
wtf!~

Does this look any better?

 

[code]



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">[CommandMethod("test")]
public
static void blah()
{
    ObjectId[] ids =
PointSelectionSet();
    if (ids == null) return;



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">   
Document doc =
       
Application.DocumentManager.MdiActiveDocument;



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">   
using (Transaction tr =
doc.TransactionManager.StartTransaction())
   
{
        foreach (ObjectId id in
ids)
       
{
            Entity
e = (Entity)tr.GetObject(id,
OpenMode.ForRead);
           
if (!(e is
DBPoint))
               
continue; //shouldn't happen with filter.



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">           
DBPoint p =
(DBPoint)e;
           
//check out p.Position; p.X;
...
            //if
you don't need the entity for
testing.
           
//DBPoint p =

           
//(DBPoint)(Entity)tr.GetObject(id,
OpenMode.ForRead);
       
}
    }
}



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">public
static ObjectId[] PointSelectionSet()
{
    Editor ed
=
       
Application.DocumentManager.MdiActiveDocument.Editor;



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">   
PromptSelectionResult psr;
    SelectionFilter sf
=
        new
SelectionFilter
           
( new TypedValue[]

             {
new TypedValue( (int)DxfCode.Start, "POINT") } );



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">   
psr = ed.SelectAll(sf);



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">   
return psr.Value != null ?
       
psr.Value.GetObjectIds() : null;



style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none">
style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">}


[/code]

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"Paul Richardson" <prichardson<lastpoint> wrote in message
href="news:6092539@discussion.autodesk.com">news:6092539@discussion.autodesk.com
...


Thanks Bill - looks great on the newsreader
side. I wish they fix this mess - I just don't get it. I won't even
read

most posts any longer as they are unreadable on
the newreader end... Here is a txt file.

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Paul,
I'm on the web side and what you just posted looks like the source code
for an html page. Unreadable here.
Bill
Message 9 of 26
BillZndl
in reply to: ethiel

Thanks Paul!

Between guessing if code is right and getting kicked off every 3 minutes,
I should be able to copy by hand the .png image (What fun!!!).

Bill
Message 10 of 26
Anonymous
in reply to: ethiel


Grab a copy of 'snagit' as it allows you to copy
text from a pic... ~).

Kidding aside - it's an invaluable
tool.


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Thanks
Paul! Between guessing if code is right and getting kicked off every 3
minutes, I should be able to copy by hand the .png image (What fun!!!).
Bill
Message 11 of 26
Anonymous
in reply to: ethiel


Here is bit more detailed filter list.  - Net
version of the LISP help menu filter.

 

//all circles with radius of 1 and all line on
layer "ABC"
TypedValue[] fList = new TypedValue[10];

 

fList[0] = new TypedValue((int)DxfCode.Operator,
"<OR");

 

fList[1] = new
TypedValue((int)DxfCode.Operator,"<AND");
fList[2] = new
TypedValue((int)DxfCode.Start,"CIRCLE");
fList[3] = new
TypedValue((int)DxfCode.Real, 1.0);
fList[4] = new
TypedValue((int)DxfCode.Operator, "AND>");

 

fList[5] = new TypedValue((int)DxfCode.Operator,
"<AND");
fList[6] = new TypedValue((int)DxfCode.Start,
"Line");
fList[7] = new TypedValue((int)DxfCode.LayerName,
"ABC");
fList[8] = new TypedValue((int)DxfCode.Operator,
"AND>");

 

fList[9] = new TypedValue((int)DxfCode.Operator,
"OR>");

 

SelectionFilter sf = new
SelectionFilter(fList);

 

//LISP filter from help menu.
// '(
// (-4 .
"<OR")
// (-4 . "<AND")
// (0 . "CIRCLE")
// (40 . 1.0)
// (-4
. "AND>")
// (-4 . "<AND")
// (0 . "LINE")
// (8 . "ABC")
//
(-4 . "AND>")
// (-4 . "OR>")
// )
//)


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Good
afternoon. ¿it can be possible to get point coordinates or line coordinates
from a dwg file using .net language?. Im spanish, please, sorry for my poor
english.
Message 12 of 26
ethiel
in reply to: ethiel

Many thanks to all.
I have readed this code, but I have a doubt.

If I can obtain object property I must pick on it.

It's possible to achieve identities (for example, only points) of a dwg without picking on it?.

I can obtain the layer but I can't access to entities inside it.

It's possible?.
Message 13 of 26
Anonymous
in reply to: ethiel


If I understand correctly you want to create a
selection set of all objects and output specific points depending

on the object type?

 

You can extend what you select by using a comma
seperated list for your objects or use no filter and grab all
entities.

face=Arial color=#000000>"POINT,LINE,CIRCLE"


color=#000000>
 


color=#000000>You'll have to check the type of entity in your loop and cast as
necessary. Then you can extract what you need.

color=#a31515 size=2>


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Many
thanks to all. I have readed this code, but I have a doubt. If I can obtain
object property I must pick on it. It's possible to achieve identities (for
example, only points) of a dwg without picking on it?. I can obtain the layer
but I can't access to entities inside it. It's
possible?.
Message 14 of 26
ethiel
in reply to: ethiel

Many thanks.
I can obtain all I need.
Only I need to know how get X-Y Coordinates of a entity.

Many thanks. I'ts very useful.
Message 15 of 26
Anonymous
in reply to: ethiel


Which entity and which xy coords??? Try typing a
dot and looking at the properties for the entity

to find the cood you want...


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Many
thanks. I can obtain all I need. Only I need to know how get X-Y Coordinates
of a entity. Many thanks. I'ts very useful.
Message 16 of 26
Anonymous
in reply to: ethiel


Check out this post...



style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Good
afternoon. ¿it can be possible to get point coordinates or line coordinates
from a dwg file using .net language?. Im spanish, please, sorry for my poor
english.
Message 17 of 26
ethiel
in reply to: ethiel

I have obtained all I needed.

Many thanks to all for replies and help me. 😄

I can post my code?.
Message 18 of 26
Anonymous
in reply to: ethiel


Sure - post how you did it so others can
see.

 

This idea works for me...

{code}

using (Transaction tr =
   
doc.TransactionManager.StartTransaction())
{
    foreach
(ObjectId id in ids)
   
{
        Entity e =

           
(Entity)tr.GetObject
         
        (id, OpenMode.ForRead);

 

        Line l =
e as Line;
        if (l !=
null)
       
{
            outPut
+=
               
(string.Format
                   
("Line startpoint:{0}\n",

                       
l.StartPoint));
           
continue;
        }

 

        DBPoint
p = e as DBPoint;
        if (p !=
null)
       
{
            outPut
+=
               
(string.Format
                   
("Point position:{0}\n",

                       
p.Position));
           
continue;
        }

 

       
//...
    }
}

{code}


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
have obtained all I needed. Many thanks to all for replies and help me. 😄 I
can post my code?.
Message 19 of 26
Anonymous
in reply to: ethiel


[code]

using (Transaction tr =
   
doc.TransactionManager.StartTransaction())
{
    foreach
(ObjectId id in ids)
   
{
        Entity e =

           
(Entity)tr.GetObject
         
        (id, OpenMode.ForRead);

 

        Line l =
e as Line;
        if (l !=
null)
       
{
            outPut
+=
               
(string.Format
                   
("Line startpoint:{0}\n",

                       
l.StartPoint));
           
continue;
        }

 

        DBPoint
p = e as DBPoint;
        if (p !=
null)
       
{
            outPut
+=
               
(string.Format
                   
("Point position:{0}\n",

                       
p.Position));
           
continue;
        }

 

       
//...
    }
}

[/code]


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"Paul Richardson" <prichardson<lastpoint> wrote in message
href="news:6093912@discussion.autodesk.com">news:6093912@discussion.autodesk.com
...


Sure - post how you did it so others can
see.

 

This idea works for me...

{code}

using (Transaction tr =
   
doc.TransactionManager.StartTransaction())
{
    foreach
(ObjectId id in ids)
   
{
        Entity e =

           
(Entity)tr.GetObject
         
        (id, OpenMode.ForRead);

 

        Line l
= e as Line;
        if (l !=
null)
       
{
            outPut
+=
               
(string.Format
                   
("Line startpoint:{0}\n",

                       
l.StartPoint));
           
continue;
        }

 

       
DBPoint p = e as DBPoint;
        if (p
!= null)
       
{
            outPut
+=
               
(string.Format
                   
("Point position:{0}\n",

                       
p.Position));
           
continue;
        }

 

       
//...
    }
}

{code}


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
have obtained all I needed. Many thanks to all for replies and help me. 😄 I
can post my code?.
Message 20 of 26
Anonymous
in reply to: ethiel


this is still unreadable in the Webreader... I
give.


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"Paul Richardson" <prichardson<lastpoint> wrote in message
href="news:6093914@discussion.autodesk.com">news:6093914@discussion.autodesk.com
...


[code]

using (Transaction tr =
   
doc.TransactionManager.StartTransaction())
{
    foreach
(ObjectId id in ids)
   
{
        Entity e =

           
(Entity)tr.GetObject
         
        (id, OpenMode.ForRead);

 

        Line l
= e as Line;
        if (l !=
null)
       
{
            outPut
+=
               
(string.Format
                   
("Line startpoint:{0}\n",

                       
l.StartPoint));
           
continue;
        }

 

       
DBPoint p = e as DBPoint;
        if (p
!= null)
       
{
            outPut
+=
               
(string.Format
                   
("Point position:{0}\n",

                       
p.Position));
           
continue;
        }

 

       
//...
    }
}

[/code]


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"Paul Richardson" <prichardson<lastpoint> wrote in message
href="news:6093912@discussion.autodesk.com">news:6093912@discussion.autodesk.com
...


Sure - post how you did it so others can
see.

 

This idea works for me...

{code}

using (Transaction tr =
   
doc.TransactionManager.StartTransaction())
{
   
foreach (ObjectId id in ids)
   
{
        Entity e =

           
(Entity)tr.GetObject
         
        (id, OpenMode.ForRead);

 

        Line
l = e as Line;
        if (l !=
null)
       
{
           
outPut
+=
               
(string.Format
                   
("Line startpoint:{0}\n",

                       
l.StartPoint));
           
continue;
        }

 

       
DBPoint p = e as DBPoint;
        if
(p != null)
       
{
           
outPut
+=
               
(string.Format
                   
("Point position:{0}\n",

                       
p.Position));
           
continue;
        }

 

       
//...
    }
}

{code}


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
have obtained all I needed. Many thanks to all for replies and help me. 😄
I can post my
code?.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost