How to understand the difference in expression methods for obtaining paper space record objects

How to understand the difference in expression methods for obtaining paper space record objects

kelidesign
Enthusiast Enthusiast
479 Views
4 Replies
Message 1 of 5

How to understand the difference in expression methods for obtaining paper space record objects

kelidesign
Enthusiast
Enthusiast

 

var blockModelSpace = ((BlockTable)db.BlockTableId.GetObject(mode))[BlockTableRecord.ModelSpace];
var blockPaperSpace = (BlockTableRecord)SymbolUtilityServices.GetBlockPaperSpaceId(db).GetObject(mode);

 

0 Likes
Accepted solutions (2)
480 Views
4 Replies
Replies (4)
Message 2 of 5

kelidesign
Enthusiast
Enthusiast

It should be obtained directly by default instead of using Table, which can reduce the complexity of the problem.

0 Likes
Message 3 of 5

kelidesign
Enthusiast
Enthusiast

It seems that a specific record is obtained through this special method. Not all, there should be multiple papers.

 

>(1794009289200) *Model_Space
>(1794009289344) *Paper_Space
>(1794009289424) *Paper_Space0

0 Likes
Message 4 of 5

_gile
Consultant
Consultant
Accepted solution

Hi,

 

As for ModelSpace, both expressions:

SymbolUtilityServices.GetBlockPaperSpaceId(db)

 

 

and

blockTable[BlockTableRecord.PaperSpace]

 

 

return the same value, i.e. the ObjectId of the blockTableRecord of the last opened paper space layout (or the first one if none have been opened in the session).

The main difference is the first one does not need to get an instance of the BlockTable (i.e. it can be used outside of a Transaction).



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 5 of 5

kelidesign
Enthusiast
Enthusiast
Accepted solution

Yes, what you said makes sense. Affairs is the most important factor.

0 Likes