parent/child blocks

parent/child blocks

razie.electric
Enthusiast Enthusiast
1,323 Views
4 Replies
Message 1 of 5

parent/child blocks

razie.electric
Enthusiast
Enthusiast

dears,

 

I am looking for autolisp codes to help me as I describe here:

 

I have a block as a parent and other blocks as child, I am looking for codes that when I use child blocks it automatically give me parent address (like k200 and k100 in the pdf I have attached).

0 Likes
1,324 Views
4 Replies
Replies (4)
Message 2 of 5

Moshe-A
Mentor
Mentor

@h@razie.electric hi,

 

from your pdf we can not tell what is k200 and what is k100?

so let assume this:

 

k100 is parent block

    k200 is the child

 

you could define such a function to insert a family block

 

 

(defun insert-family-block (blkname ins)
 (if (wcmatch (strcase blkname) "K100,K200,K300,K400")
  (progn
   ; your code
   (command "._insert" "k100" ins 1 1 0)
   ; your code
  )
 )
)

usage:

 

(insert-family-block "block-name" ins-point)

 

the parent block will be insert even if a child block is specified

 

moshe

 

 

0 Likes
Message 3 of 5

razie.electric
Enthusiast
Enthusiast

I THINK THERE IS A MISUNDRESTANDING

 

I ATTACHED THE FILE AGAIN 

0 Likes
Message 4 of 5

Moshe-A
Mentor
Mentor

@razie.electric,

 

 

explain what do you mean by "when i use child block it automatically give give me parent address"?

when i use means: insert?

parent address means: coordinates? block name? 

 

 

 

0 Likes
Message 5 of 5

razie.electric
Enthusiast
Enthusiast

YES exactly when I insert the block child it should shows the adress of block parent just like how the attached file shows

the address is the page name which has been shown in the corner of page( right-down)(8302 is the address of sheet ) and as you see the address of k200(child block) is 8302.5 (.5 shows the number of sheet's row)

0 Likes