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

Problem with getting a Surface property of BoundaryRepresentation.Face obj

0 REPLIES 0
Reply
Message 1 of 1
tyumener
226 Views, 0 Replies

Problem with getting a Surface property of BoundaryRepresentation.Face obj

Hi all,

I have a problem with calling a property Surface of Autodesk.AutoCAD.BoundaryRepresentation.Face object. Sometimes, an instance of Autocad falls down, when I call the procedure that is written bellow more than one time – the more complex the model is the sooner it occurs (number of successful attempts varies from 1 to 6-7).

I can’t find out why the problem occurs. I would really appreciate any help.

Here’s the code I’m using:

Transaction tr = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction();
try
{
BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
BlockTableRecord btr = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead);
foreach (ObjectId id in btr)
{
DBObject obj = tr.GetObject(id, OpenMode.ForRead);
System.Type objType = obj.GetType();
if (objType.ToString() == "Autodesk.AutoCAD.DatabaseServices.Solid3d")
{
ObjectId[] objIds = { obj.ObjectId };
Solid3d sol = (Solid3d)obj;
Brep brp = new Brep(sol);
foreach (Complex cmplx in brp.Complexes)
{
foreach (Shell shll in cmplx.Shells)
{
foreach (Autodesk.AutoCAD.BoundaryRepresentation.Face fce in shll.Faces)
{
ExternalBoundedSurface bSurface = fce.Surface as ExternalBoundedSurface;
Type entType = bSurface.ExternalBaseSurface.nativeSurface.GetType();
}
}
}
}
}
tr.Commit();
}
catch (System.Exception ex)
{
tr.Abort();
}
finally
{
tr.Dispose();
}
0 REPLIES 0

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