-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ax.AcadBlock.insertBlock
inappropriate error type when block does not exist
#219
Comments
I assume, if the block does not exist, then ‘name’ should be the full path for the .dwg file to insert from pyrx import Rx, Ge, Gi, Db, Ap, Ed, Ax, command
@command
def xdoit():
axApp = Ap.Application.acadApplication()
axDoc = axApp.activeDocument()
newBlockName = "WOOHOO"
axBlocks = axDoc.blocks()
names = [blk.name() for blk in axBlocks]
if not newBlockName in names:
btr = axBlocks.add(Ge.Point3d(0, 0, 0), newBlockName)
btr.addCircle(Ge.Point3d(0, 0, 0), 5)
axSpace = axDoc.modelSpace()
bref = axSpace.insertBlock(Ge.Point3d(0, 0, 0), newBlockName, Ge.Scale3d(1.0), 0.0)
@command
def xdoit2():
axApp = Ap.Application.acadApplication()
axDoc = axApp.activeDocument()
axSpace = axDoc.modelSpace()
pth = "M:\\Dev\\Projects\\PyRxGit\\tests\\media\\18X36RP.dwg"
bref = axSpace.insertBlock(Ge.Point3d(0, 0, 0), pth, Ge.Scale3d(1.0), 0.0) |
CEXT-Dan
added a commit
that referenced
this issue
Mar 18, 2025
added from pyrx import Rx, Ge, Gi, Db, Ap, Ed, Ax, command
@command
def xdoit():
axApp = Ap.Application.acadApplication()
axDoc = axApp.activeDocument()
newBlockName = "WOOHOO"
axBlocks = axDoc.blocks()
if not axBlocks.has(newBlockName): # has
btr = axBlocks.add(Ge.Point3d(0, 0, 0), newBlockName)
btr.addCircle(Ge.Point3d(0, 0, 0), 5)
axSpace = axDoc.modelSpace()
bref = axSpace.insertBlock(Ge.Point3d(0, 0, 0), newBlockName, Ge.Scale3d(1.0), 0.0) |
CEXT-Dan
added a commit
that referenced
this issue
Mar 29, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When the block exists everything is ok, if not - I get this message.
The text was updated successfully, but these errors were encountered: