cart: empty [ Login ]

Could not get the list of external reference files properly - CADLib 4.0

1 
Balaji Naidu
2/13/2014 8:38 AM
Hi Wout, i have installed the CADLib 4.0 evaluation for 30 days. i have the requirement of read/write the dwg/dxf blocks and their attributes and drawing properties and reference files information. i am done with blocks and attributes extraction successfully. i faced an issue at getting external reference files information.i tried the below code on attached dwg file.
C# Code:
DwgReader dwgReader = new DwgReader(@"D:\child1.dwg"); DxfModel dxfModel = dwgReader.Read(); DxfBlockCollection blockCollection = dxfModel.Blocks; string strAllRefFiles = string.Empty; foreach (DxfBlock block in blockCollection) { if (block.IsExternalReference == true) strAllRefFiles += "\n" + block.Name; } if (strAllRefFiles.Length == 0) strAllRefFiles = "None of the Reference files Found!"; MessageBox.Show(strAllRefFiles);
issue: the issue is after executing the above code it is showing that there is one file named child2.dwg is referenced in this dwg "child1.dwg".in fact there are none of the files referenced in it. please try out at your end whether the issue is replicating or not.if i did any thing wrong please let me know. you can also suggest me in case of any other way of extracting reference files information is existed. please do the needful asap because we need to take the decision of buying this library immediately.
Wout
2/13/2014 8:51 AM
Have a look at property DxfBlock.ExternalReference, which contains the filename of the referenced drawing. The block name is just a name, not a filename. - Wout
Balaji Naidu
2/13/2014 9:50 AM
He Wout, thanks for your quick response. as you said, when i use DxfBlock.ExternalReference property it showed the complete file name instead of block name, that is fine but i am wondering about where the child2 file is coming from as an external reference. you can see that the child2 file is not referenced in child1 in fact. hope you understand my actual issue. please get back to me if you need further information on this. thank you.
Wout
2/13/2014 9:53 AM
Child1.dwg contains one block, which does reference Child2.dwg (see model.Blocks[0].ExternalReference), so I don't see what the problem is. - Wout
Balaji Naidu
2/13/2014 9:59 AM
did you see the child1.dwg by opening in autocad?
Wout
2/13/2014 10:08 AM
Please read the documentation on DxfBlock.ExternalReference and on how to load external references. I will have time again on Monday. Good luck! - Wout
Balaji Naidu
2/13/2014 10:41 AM
its ok. you can look into it on monday. my issue is when i opening the child1.dwg in autocad 2012 manually, i could see that there are none of the blocks/blockdefinitions/external reference files existed in that(using "xr" and "i" commands).when i read it programmatically using cadlib library, it is saying that one external reference file "D:\Temp\child2.dwg" is existed in that. i also tried programmatically with autocad.net api and it was saying that no blocks/external reference files existed in the child1.dwg which is correct.i might not explained you properly in my earlier posts.sorry for that.
Balaji Naidu
2/18/2014 7:26 AM
hi wout, can you look into it asap, we need to buy before trial expires
Wout
2/18/2014 9:22 AM
If you post your code, and specify exactly what values you are expecting from specific objects and properties, then I can look into it. At the moment I have no idea what you are trying to do. - Wout
1