block with attributes and fields

block with attributes and fields

NERDASORUS
Advocate Advocate
3,294 Views
4 Replies
Message 1 of 5

block with attributes and fields

NERDASORUS
Advocate
Advocate

Hello.

I want to create a Block with attributes and Fields ,that when i Insert it it promotes me to enter the attributes value , and pick 2 objects for the fields , the question is is that possible ,and how 

thanks in advance.

0 Likes
3,295 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable

@Anonymous.melhem wrote:

Hello.

I want to create a Block with attributes and Fields ,that when i Insert it it promotes me to enter the attributes value , and pick 2 objects for the fields , the question is is that possible ,and how 

thanks in advance.


Here's a good place to start: https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2016/ENU/AutoCAD-Core/files/GUID-67A2DDAD-2217-412F-8AEF-D4495192F45B-htm.html

0 Likes
Message 3 of 5

dbroad
Mentor
Mentor

Yes.

Without doing it for you, this is the process:

 

First create the block with the attributes.  Do this manually.

Save the block to a library location so it is available for insert.

 

Insert the block manually. Write down the prompts. 

 

Create an object field with the field command. Set it up just like you want in the block attributes.

Look at the field code.  All you need to replicate is the stuff to the left and right of the objectid, properly formatted.

 

Write a lisp command that uses the insert command prototyped here

 

(defun c:yourcommand ( nil / local arguments )

...set environment correctly, including error handler.

...

ask user to select objects with ssget or entsel

...vet the selection

...convert the enames to objectids for the fields.

...build the field based on looking at object fields you've built before

(command "_.insert"  "yourblockname" ... answers to prompts you wrote down including attributes....)

 

...cleanup

)

Architect, Registered NC, VA, SC, & GA.
Message 4 of 5

NERDASORUS
Advocate
Advocate

thanks for your reply , when you get the field part i cant follow , and i have no idea how to write lisps , could you please elaborate some more

0 Likes
Message 5 of 5

NERDASORUS
Advocate
Advocate

thanks for your reply , but the link you posted just talks about attaching link attribute to a block , what i want to have is the block promotes me to enter 2 values (attributes) and to take the length of two lines (fields) all in the same block. and give the result in text 

0 Likes