How to read ViewPort ??

How to read ViewPort ??

sandeep_vaal
Enthusiast Enthusiast
401 Views
3 Replies
Message 1 of 4

How to read ViewPort ??

sandeep_vaal
Enthusiast
Enthusiast

Hello,

 

I having some questions on paper space records/layout's.

 

Can we read ViewPort geometry entities.? Is it possible to get whatever data present inside the ViewPort. ?

 

Can we get scale value for multiple viewports ?

 

I have written some sample code, to read all the layouts from dwg file. I am trying to read each layout, in that I am able to read other entities like Circle/polyline/Line etc but I am not able to read Viewport.

 

Can you please have a look on below sample code.

 

Thanks in advance ‼!

 

Regards,

Dinesh

dinesh.gavsane@vaal-triangle.com

 

      DBDictionary layoutListRecord = transaction.GetObject(this.database.LayoutDictionaryId, OpenMode.ForRead) as DBDictionary;
            if (layoutListRecord != null)
            {
                // Step through and list each named layout and Model
                foreach (DBDictionaryEntry item in this.layoutListRecord)
                {
                    string layoutName = item.Key;
                    // Get the layout and block objects from the external drawing
                    Layout layEx = this.layoutListRecord.GetAt(layoutName).GetObject(OpenMode.ForRead) as Layout;
                    BlockTableRecord blkBlkRecEx = transaction.GetObject(layEx.BlockTableRecordId, OpenMode.ForRead) as BlockTableRecord;

                    
                    foreach (ObjectId id in blkBlkRecEx)
                    {
                        var entity = transaction.GetObject(id, OpenMode.ForRead) as Entity;
                        if (null == entity)
                            continue;
                      

                        if (entity is Viewport)
                        {
                            // How to use this viewport
                            //I want to read the geometry entities from viewport
                            Viewport vPort = entity as Viewport;
                        }
                    }
                }
            }

0 Likes
402 Views
3 Replies
Replies (3)
Message 2 of 4

leothebuilder
Advisor
Advisor

It's best to post your question in the lisp customization forum:

 

http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/bd-p/130

0 Likes
Message 3 of 4

dbroad
Mentor
Mentor

Proabably the .NET forum would be the best place to post.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 4 of 4

leothebuilder
Advisor
Advisor

Sorry, I should have pointed you to the .net forum:

 

http://forums.autodesk.com/t5/net/bd-p/152

0 Likes