-
One has created a block from def createSectionBlock(db : Db.Database, name : str, ents: list[Db.Entity]):
bt = Db.BlockTable(db.blockTableId(), Db.OpenMode.kForWrite)
btr = Db.BlockTableRecord()
btr.setName(name)
btrid = bt.add(btr)
btr.appendAcDbEntities(ents)
return btrid
@Ap.Command()
...
section_geo = []
for _items in sec.generateSectionGeometry(ent):
for item in _items:
section_geo.append(item.getTransformedCopy(mat))
blkid = createSectionBlock(db, str(sec.getHandle()), section_geo)
... |
Beta Was this translation helpful? Give feedback.
Answered by
schoeller
Jun 13, 2025
Replies: 1 comment
-
Then if one wants to scale the block reference on insertion one could add another funtion: def insertBlockRef(db: Db.Database, btrid: Db.ObjectId, coords: Ge.Point3d, scale: Ge.Scale3d):
blockRef = Db.BlockReference(coords, btrid)
blockRef.setScaleFactors(scale)
model = Db.BlockTableRecord(db.modelSpaceId(), Db.OpenMode.kForWrite)
blockRefId = model.appendAcDbEntity(blockRef)
return blockRefId and in brefid = insertBlockRef(db, blkid, Ge.Point3d(2,2,0), Ge.Scale3d(4., .5, 1.)) Zero values in Scale3d are not permitted by default |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
schoeller
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Then if one wants to scale the block reference on insertion one could add another funtion:
and in
main()
one could then call after closing the block table.Zero values in Scale3d are not permitted by default