Skip to content
Discussion options

You must be logged in to vote

Hi, try this code on the screw block

import traceback
from pyrx import Ap, Ax, Db, Ed, Ge, Gi, Rx


@Ap.Command()
def doit():
    try:
        db = Db.curDb()
        ps, id, _ = Ed.Editor.entSel("\nPick a block", Db.BlockReference.desc())
        if ps != Ed.PromptStatus.eOk:
            raise RuntimeError("Selection Error! {}: ".format(ps))

        #check if it's dynamic
        dynref = Db.DynBlockReference(id)
        if not dynref.isDynamicBlock():
            print("oof")
            return
        
        #this should return the effective name
        ref = Db.BlockReference(id)
        print("\n{}".format(ref.getBlockName()))
        
        #better to put this in its own funct…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@royccg
Comment options

Comment options

You must be logged in to vote
4 replies
@CEXT-Dan
Comment options

Answer selected by royccg
@royccg
Comment options

@royccg
Comment options

@CEXT-Dan
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants