.NET

Reply
Active Member
awdas
Posts: 7
Registered: ‎10-21-2012
Message 1 of 9 (594 Views)

How to extrude imported dxf along polyline?

594 Views, 8 Replies
10-21-2012 05:34 PM

I have region is in external dxf file,

how to extrude it along polyline?

 

I can't get region after using dxfin method

 

                    Database myDxfDb = new Database(false, true);
                    myDxfDb.DxfIn(filename, logFilename);
                    Matrix3d dxfTrf = Matrix3d.Identity;
                    _ThisDatabase.Insert(dxfTrf, myDxfDb, true);
                    _ThisDatabase.UpdateExt(true);
                    myDxfDb.Dispose();
                    acTrans.Commit();

                    ObjectId id = AcUtils.EntLast();
                    Entity _ent = (Entity)acTrans.GetObject(id, OpenMode.ForWrite);

 

 

*Expert Elite*
Alfred.NESWADBA
Posts: 9,401
Registered: ‎06-29-2007
Message 2 of 9 (593 Views)

Re: How to extrude imported dxf along polyline?

10-21-2012 05:41 PM in reply to: awdas

Hi,

 

look to the objecttype that is the result of inserting the DXF ==> is it a region or is it a block(definition/-reference....) :smileywink:

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Active Member
awdas
Posts: 7
Registered: ‎10-21-2012
Message 3 of 9 (588 Views)

Re: How to extrude imported dxf along polyline?

10-21-2012 05:46 PM in reply to: Alfred.NESWADBA

dxf file contain only one region object

*Expert Elite*
Alfred.NESWADBA
Posts: 9,401
Registered: ‎06-29-2007
Message 4 of 9 (584 Views)

Re: How to extrude imported dxf along polyline?

10-21-2012 05:51 PM in reply to: awdas

Hi,

 

and now try to insert this DXF into another drawing ==> what does it get then?

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Active Member
awdas
Posts: 7
Registered: ‎10-21-2012
Message 5 of 9 (581 Views)

Re: How to extrude imported dxf along polyline?

10-21-2012 05:57 PM in reply to: Alfred.NESWADBA

Hi alfred,

 

yes, I can that. dxf import as block reference.

 

well, how can I use this block reference :smileyhappy:

*Expert Elite*
Alfred.NESWADBA
Posts: 9,401
Registered: ‎06-29-2007
Message 6 of 9 (573 Views)

Re: How to extrude imported dxf along polyline?

10-21-2012 06:04 PM in reply to: awdas

Hi,

 

either explode it or use the BlockTableRecord from this object to get the parts of this blockdefinition, there you also find then the region. You can then create an extrusion if this and add it to the database.

 

Good luck, -  alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
*Expert Elite*
Alfred.NESWADBA
Posts: 9,401
Registered: ‎06-29-2007
Message 7 of 9 (571 Views)

Re: How to extrude imported dxf along polyline?

10-21-2012 06:09 PM in reply to: awdas

Hi,

 

and a sample for how to create 3D-solids from 2D-objects could be found >>>here<<< (and Kean Walmsley has a lot more interesting samples on his site)

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Active Member
awdas
Posts: 7
Registered: ‎10-21-2012
Message 8 of 9 (562 Views)

Re: How to extrude imported dxf along polyline?

10-21-2012 07:16 PM in reply to: Alfred.NESWADBA

thanks a lot for your interrest alfred,

 

but my problem is not extrude region. I cant get region from dxf file.

Active Member
awdas
Posts: 7
Registered: ‎10-21-2012
Message 9 of 9 (547 Views)

Re: How to extrude imported dxf along polyline?

10-21-2012 10:10 PM in reply to: awdas

I found the solution

 

        public Entity ImportDxfAsEntity(string FileName, Point3d InsertionPoint, double Rotation = 0)
        {
            ObjectId blkid = ObjectId.Null;
            Entity ent = null;
            using (Database bdb = new Database(false, true))
            {
                bdb.DxfIn(FileName, @"c:\log.txt");
                //blkid = _ThisDatabase.Insert(System.IO.Path.GetFileNameWithoutExtension(FileName), bdb, true);
                blkid = _ThisDatabase.Insert("blok", bdb, true);
                using (Transaction tr = _ThisDatabase.TransactionManager.StartTransaction())
                {
                    BlockReference bref = new BlockReference(InsertionPoint, blkid);
                    using (BlockTableRecord btAttRec = (BlockTableRecord)bref.BlockTableRecord.GetObject(OpenMode.ForWrite))
                    {
                        foreach (ObjectId subid in btAttRec)
                        {
                            ent = (Entity)subid.GetObject(OpenMode.ForRead);
                        }
                    }
                    tr.Commit();
                }
            }
            return ent;
        }

 

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!