Author Topic: DXF Code missing in Solid3d when created via code ?  (Read 3298 times)

0 Members and 1 Guest are viewing this topic.

bikelink

  • Guest
DXF Code missing in Solid3d when created via code ?
« on: July 22, 2008, 05:03:14 AM »
Hy , I have a problem with an object  "solid3d".


If I build a solid with normal command  line , the resultbuffer about it is this..
{((-1,(2129671440))(0,ACSH_HISTORY_CLASS)(330,(2129671416))(5,1E2)(100,AcDbShHistory)(90,27)(91,50)(360,(2129671432))(92,1)(280,0)(281,1))}
{((-1,(2129671432))(0,ACAD_EVALUATION_GRAPH)(330,(2129671440))(5,1E1)(100,AcDbEvalGraph)(96,1)(97,1)(91,0)(93,32)(95,1)(360,(2129671424))(92,-1)(92,-1)(92,-1)(92,-1))}   


and when I build via code a solid the result buffer is ..
{((-1,(2129671464))(0,ACSH_HISTORY_CLASS)(330,(2129671448))(5,1E5)(100,AcDbShHistory)(90,27)(91,50)(360,(2129671456))(92,0)(280,1)(281,1))}
{((-1,(2129671456))(0,ACAD_EVALUATION_GRAPH)(330,(2129671464))(5,1E4)(100,AcDbEvalGraph)(96,0)(97,0))}   
 :x :x :x :x



This is my code..

Code: [Select]
public static ObjectId createACube(Vector3d location, Double length)
         {
             Database db = HostApplicationServices.WorkingDatabase;
             Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

             ObjectId idsolido = ObjectId.Null;

             using (Transaction trans = db.TransactionManager.StartTransaction())
             {
                 Solid3d sol = new Solid3d();
                 sol.CreateBox(length, length, length);
                 sol.RecordHistory = true;

               

                 Matrix3d mat;
                 mat = Matrix3d.Identity;
                 mat = Matrix3d.Displacement(location);
                 sol.TransformBy(mat);
                 BlockTableRecord curSpc = (BlockTableRecord)trans.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
                 curSpc.AppendEntity(sol);
                 trans.AddNewlyCreatedDBObject(sol, true);


                 // sol.SetDatabaseDefaults();
               
                 // sol.Material = nameWood;
                 sol.ShowHistory = true;
                 
                 trans.Commit();

                 // OTHERS UTILITY FUNCTIONS.
                 ResultBuffer rbSolidocube = b2Editor.entGet(sol.ObjectId);
                 Matrix3d mcube = b2Editor.GetSolidMatrix(rbSolidocube);
                 idsolido = sol.ObjectId;
             }
             return idsolido;
         }


What's my mistake ? 
Thanks in advance... ! Any suggestion will be appreciated

edited by Dan: added code tags
« Last Edit: July 22, 2008, 12:51:05 PM by Daniel »

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8722
  • AKA Daniel
Re: DXF Code missing in Solid3d when created via code ?
« Reply #1 on: July 22, 2008, 01:54:17 PM »
Strange, when you get the properties of your new object, it doesn’t show up as a box  :-o

bikelink

  • Guest
Re: DXF Code missing in Solid3d when created via code ?
« Reply #2 on: July 22, 2008, 05:10:28 PM »
 :-o :-o  and this is another problem!
it looks different from a solid also in the property... very bad... i'm going crazy about this.. :ugly:


bikelink

  • Guest
Re: DXF Code missing in Solid3d when created via code ?
« Reply #3 on: July 23, 2008, 05:21:52 AM »


Mr Tony Tanzillo answers:


The APIs for solid modeling objects in AutoCAD is deliberately hobbled.

The AcDb3dSolid methods that create 'primitives' actually create only the solid body, but not the information that gives it its primitive identity and properties. The only way to do that is via the creation commands.

Unfortunately, due to the way Autodesk does things (hindering the development of applications that compete with Inventor, along with many that do not), there is not much anyone can do about it.


very very bad..
 :pissed: :pissed: :pissed: :pissed: :pissed: 

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8722
  • AKA Daniel
Re: DXF Code missing in Solid3d when created via code ?
« Reply #4 on: July 23, 2008, 05:25:31 AM »
Well that’s no fun!

SEANT

  • Bull Frog
  • Posts: 345
Re: DXF Code missing in Solid3d when created via code ?
« Reply #5 on: July 23, 2008, 07:38:54 AM »
You don't think a random exception generator has been implemented in the BRep API, do you? :|
Sean Tessier
AutoCAD 2016 Mechanical

SEANT

  • Bull Frog
  • Posts: 345
Re: DXF Code missing in Solid3d when created via code ?
« Reply #6 on: July 23, 2008, 07:41:22 AM »
I suppose that would be a significant step beyond "deliberately hobbled".  I withdraw the implication above.
Sean Tessier
AutoCAD 2016 Mechanical

Chuck Gabriel

  • Guest
Re: DXF Code missing in Solid3d when created via code ?
« Reply #7 on: July 23, 2008, 07:49:59 AM »
You might try creating your box by extruding a rectangle instead of using CreateBox.  Here is an example in native code:

Code: [Select]
AcDbPolyline* pPline = new AcDbPolyline;
// Draw the profile you want to extrude, orient it in 3space and set
// its normal vector

// Convert the polyline to a region, so it can be extruded
AcDbVoidPtrArray curves, regions;
curves.append(pPline);
AcDbRegion::createFromCurves(curves, regions);
delete pPline;
AcDbRegion* pRegion = reinterpret_cast<AcDbRegion*>(regions[0]);
AcDb3dSolid* pSolid = new AcDb3dSolid();
pSolid->extrude(pRegion, extrusionLength, 0);
delete pRegion;

[edit]had an unused variable in there[/edit]
« Last Edit: July 23, 2008, 07:56:27 AM by Chuck Gabriel »

Draftek

  • Guest
Re: DXF Code missing in Solid3d when created via code ?
« Reply #8 on: July 23, 2008, 08:10:52 AM »
Yeah.

I've been wanting to write some 3D solid applications for AutoCAD for some time.

I finally gave up and moved to Inventor.

You can do it but it's going to require C++ objectarx and some low level manipulation.

bikelink

  • Guest
Re: DXF Code missing in Solid3d when created via code ?
« Reply #9 on: July 24, 2008, 06:13:35 AM »
I know cpp an Arx... but the customer just use Autocad. The result doesn't change if I build a program with ObjArx.. the solid remain a "simple body"
Isn't easy to say him " Hey friend You must buy a lot of Inventor license..." 'cause autocad  hobbles his product..  :ugly:
The solid that I build in the real application isn't never a simple box..  :-P and the suggest above this dooes't give us a good result.. always a "false solid" is resulted.
I disagree with this products management.