Jump to content

Attributes Updating From the command line.


Lawrst

Recommended Posts

Specifically the prompts.

 

Essentially we have a heap of attributes (200 or so) for a complicated block we are making. We have easily got them into the form as below.

 

(copy this into your command line, its quite useful for larger blocks)

 

-attdef

 

MotorName

MotorName_Blah

XX

0,7.5

1.7

0

-attdef

 

StarterType

StarterType_Blah

XX

0,15

1.7

0

-attdef

 

StarterRef

StarterRef_Blah

XX

0,22.5

1.7

0

-attdef

 

SheetNumber

SheetNumber_Blah

XX

0,30

1.7

0

-attdef

 

PowerValue

PowerValue_Blah

XX

0,37.5

1.7

0

-attdef

 

PowerUnit

PowerUnit_Blah

XX

0,45

1.7

0

-attdef

 

CurrentValue

CurrentValue_Blah

XX

0,52.5

1.7

0

 

My plan is to use a lookup table to move them around as required. but thats getting away from the question.

 

The question comes down to this.

Am i able to edit a prompt, or a default value of the attribute from the command line?

 

I have a program that could batch this out over multiple drawings and it would make a massive difference top the time take. But all the commands i have found that let me edit these require me to select the individual attributes

(i was hoping to use the attribute name as a reference source.)

 

I dont mind if it needs to be within the block editor or standard drawing space.

 

Thanks.

Link to comment
Share on other sites

1st of if you use Bedit it allows the edit of the Block ie its global and includes stuff like tag name and default value. Its not very script or lisp friendly.

 

But if you look into editing a block via "block Table" which is at the top level and using entmod you should be able to do what you want with tag names and defauts etc.

 

Editing the attribute value over multiple drawings is not a problem using the tag name, there is plenty of examples here.

 

Lee-mac has a block editor have a look, it works over multiple drawings.

 

Another is "change the value of the 3rd attribute to 3" you can use the creation order of a block's attributes and dont need tag names.

 

Moving the attribute order can be done by just changing a attribute value this was asked by some one else about a month ago and looked at two lists original order, new order list1 1 4 7 list2 5 2 6. The post ground to a halt awaiting feedback from the poster.

Link to comment
Share on other sites

LT is limited to what you can do as far as automating is concerned and one of our big issues is getting around dialogue boxes, you can create attributes and even alter their values after insertion via a script but as far as I am aware the only way to alter the default values is through either a dialogue or the properties palette. The default values are only used when you initially insert a block, so your only option maywel be to recreate the block and if you need it in an existing drawing with the new defaults then use the design center to redefine the block from an external source.

I just had quick play around, and using the -block as a command line input option will also let you redefine a block so long as you keep the tag names the same it will redefine the default prompt and default value for existing blocks if you use the same block name. Post a bit more info on the specifics of what you are wanting to change exactly if you need any more help. But hopefully this will get you going.

Link to comment
Share on other sites

Hey guys thanks for the replies, it is appreciated.

 

Essentially the only part of a block I want to change is an Attributes Prompt. Default Values would be a nice addition but are not critical to what I am trying to achieve.

 

So a little more information. We have set values for the Attributes, these are generic terms such as CC_ATT1, CC_ATT2 etc.

 

Those wont change, we have created spreadsheets around these for importing attribute values into blocks. These are the basis of how are building these blocks.

(I work with programmers and they can do some amazing things with spreadsheets to generate information for us drafters)

 

What I specifically want to do is have a way to edit a block to be able to change the Prompts.

The prompts are important to us as its the only way that we know what attribute exactly we are looking at when we are modifying things manually in the final tweaking.

 

So if we know the block name and attribute name, can we change that value via the command line?

 

Currently as I am building a block I am typing all of these prompts by hand, If however i could do it via the command line I have an excel file that can build a .txt file that i simply copy the contents into the command line. The initial post I had was generated from that excel file. z

 

BIGAL

 

Specifically from your post can you point me in the right direction in regards to the "block table"

A google search only brings up dynamic blocks properties table. I do have a feeling since you referenced entmod i wont be able to use it as I am running on AutoCAD 2014 LT

Link to comment
Share on other sites

What I specifically want to do is have a way to edit a block to be able to change the Prompts.

Take a look at the attached excel file.

The first column creates a block with 3 attributes, if you then insert a few blocks with various values just to see what happens, then run the second set of commands from column 3, this updates the default prompt and value of the block, but only changes the prompt in any blocks that already exist in the drawing. Which I imagine is what you are hoping to do.

I would make a copy of any drawings before you run anything like this in any of your actual working drawings, you never know what might happen. And make sure that even if you leave some attributes unchanged it is probbably a good idea to still include them when you redefine a block just to keep things consistent.

There are all sorts of possible outcomes for this type of script and I can see it causing problems at some point if you don't pay attention, for example you could end up with multiple blocks with the same name but all having different contents.

But take a look and see if you can get it to do what you want.

PS in the excel file just select the cells colored yellow when you are pasting it into Autocad (in order to limit the selection I have used a layer called "block" and alter the selectionsimilar variable to suit, the default value is 130 but you may have it set differently).

Long winded description but hopefully it will help in some way.

Blocks.xls

Link to comment
Share on other sites

Thanks for the efforts mate.

 

I have had a look and thats basically the solution I was going to use.

 

I have a batch program that i have wrote a script to redefine a block from a file path.

 

So essentially is is as follows with a bit of tweaking.

 

-insert

block1 = C:\test\block1.dwg

y

0,0

1

0

zoom

extents

erase

last

 

The downfall is that i need to make sure i then attsync everything before saving (which i also do within the batch program) Im just not sure how my attribute values will be effected.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...