Jump to content

Attribute Modification Suite


Lee Mac

Recommended Posts

With the recent influx of requests for LISPs that will alter multiple attributes, I have decided to create this Attribute Modification Suite.

 

Currently, it contains three functions: MvAtt, RoAtt & EdAtt, these will Move, Rotate and Edit multiple attributes respectively.

 

Any suggestions, comments, (and of course, bug reports!), are welcome :)

 

Enjoy,

 

Lee

Code available here.

Edited by Lee Mac
Link to comment
Share on other sites

  • Replies 59
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    25

  • The Buzzard

    8

  • JeepMaster

    3

  • MarcoW

    3

Top Posters In This Topic

Posted Images

Dynamite Lee,

 

You taught your name how to dance. :shock:

But can it do a Triple Lindy? :lol:

 

You are really something.

Great Work!

The Buzzard

Link to comment
Share on other sites

Dynamite Lee,

 

You taught your name how to dance. :shock:

But can it do a Triple Lindy? :lol:

 

You are really something.

Great Work!

The Buzzard

 

Thanks Buzzard, I'm glad you like it :D

 

More updates to come - as I always say, the hardest part is thinking of what to make/add to the programs.

Link to comment
Share on other sites

Thanks Buzzard, I'm glad you like it :D

 

More updates to come - as I always say, the hardest part is thinking of what to make/add to the programs.

 

I know exactly what you mean. I find myself thinking many times "What am I going to start on next?". You know as well as I do that there is only so much you can do to an entity, But some people come up with some amazing if not crazy ideas. I know you eat that stuff right up and make these ideas possible.

 

What can I say Lee?

You are one of a kind.

Link to comment
Share on other sites

Thanks Buzzard :)

 

I have updated the first post to include a new version, complete with a new function for editing the attribute values :)

 

Lee

Link to comment
Share on other sites

Lee, you said:

... the hardest part is thinking of what to make/add to the programs.

 

There is where I come in haha, I allways manage to come up with probs that other people must solve...:x But I'm too busy with my work that I can't spend enough time figuring out decent lisp programming. That's why I am that enthousiast whenever you come up wit an idea, solution or just a routine to try. (I shouldn't be doing that either if it where my boss to say)...

 

BTW, I draw electrical plans and do a lot of engineering, so I have lots of block with attributes.

 

The routine I found (atrot.lsp) I now use to rotate my attributes work quite nice. Allthough one thing still annoys me.

 

(defun c:atrot  (/ blSet attLst errCount tmp)
 (or atrot:tag (setq atrot:tag ""))
 (setq tmp (getstring (strcat "\nSpecify Tag to be Rotated <"
                              (if (eq "" atrot:tag) "*all*" atrot:tag) ">: ")))
 (or (eq "" tmp) (setq atrot:tag tmp))
 (princ "<<< Select blocks to rotate attributes >>>")
 (setq errCount 0)
 (if
   (setq blSet (ssget '((0 . "INSERT") (66 . 1))))
    (progn
      (setq blSet (mapcar 'vlax-ename->vla-object
                          (vl-remove-if 'listp
                            (mapcar 'cadr (ssnamex blSet)))))
      (foreach itm  blSet
        (setq attLst
               (vlax-safearray->list
                 (vlax-variant-value
                   (vla-GetAttributes itm))))
        (foreach att  attLst
          (and (eq (if (eq "" atrot:tag)
                     (vla-get-TagString att) atrot:tag)
                   (vla-get-TagString att))
          (if (vl-catch-all-error-p
                (vl-catch-all-apply
                  'vla-put-Rotation
                    (list att 0.0)))
            (setq errCount (1+ ErrCount)))))))
    (princ ">>> Nothing selected! <<<"))
 (if (/= 0 errCount)
   (princ
     (strcat "\n>>> " (itoa errCount)
             " attributes or blocks were on locked layer! <<< ")))
 (princ))

 

Why shouldn't my blocks be inserted with the right kind of attribute rotation? There is a lisp that should do it but it never worked for me.

 

Another prob with the atrot is (see the images below) the justification of the attribute. I can't explain but you see...

 

This is how I use it:

Attribute rotation = 0 then leave it

Attribute rotation = 90 then leave it

Attribute rotation = 180 then rotate to 0

Attribute rotation = 270 then leave it

Attribute rotation = else then leave it

1.jpg

2.jpg

Link to comment
Share on other sites

The rotation problem you are encountering when using the LISP program is caused by the Justification setting of the attributes in your blocks. Set it to Middle Center and all should be fine.

 

I recognise the LISP you posted as I believe it is a modification of ASMI's original LISP that I modified a while back. I may consider changing my above program to include block selection/all option instead of just defaulting to all.

 

Lee

Link to comment
Share on other sites

I have updated the code in my first post to include Version 3 of the program.

 

The user can now Select which Blocks he/she wants to modify, or hit enter to select all blocks with the same tag.

 

Enjoy,

 

Lee

Link to comment
Share on other sites

I have made a huge update to the EdAtt function, and Version 4 is now in the first post. :)

 

Lee

 

Lee that's nice!

 

But suppose your using different blocks that have the same attribute tag and want to modify by the tag name, Can this be done?

 

Buzzard

Link to comment
Share on other sites

Lee that's nice!

 

Thanks mate :D

 

But suppose your using different blocks that have the same attribute tag and want to modify by the tag name, Can this be done?

 

Not currently with this program, but I would think that to incorporate it would mean scanning every block in the drawing for the correct tag.. which would slow the program down somewhat. So, I suppose the alternative is to run the program twice - once on each block, on the same tag.

 

 

awesome program Lee!!! That can be very useful for me. Thanks brotha from anotha motha. 8)

 

Thanks Styk - I'm glad you like it mate :)

 

 

Lee

Link to comment
Share on other sites

Thanks mate :D

 

 

 

Not currently with this program, but I would think that to incorporate it would mean scanning every block in the drawing for the correct tag.. which would slow the program down somewhat. So, I suppose the alternative is to run the program twice - once on each block, on the same tag.

 

 

 

 

Thanks Styk - I'm glad you like it mate :)

 

 

Lee

 

Could it be set-up to have it as an option? Another words enter a tag name and edit, move or rotate the attributes based on that choice.

I am not sure if that is the way to go since I am sure you know better. Just a thought.

Link to comment
Share on other sites

Could it be set-up to have it as an option? Another words enter a tag name and edit, move or rotate the attributes based on that choice.

I am not sure if that is the way to go since I am sure you know better. Just a thought.

 

Thanks for the suggestion Buzzard, you know that I am always open to them - but in this case, I would rather stick to the tag selection method as it stands, as scouting for tag names is a bit of a palava, whereas currently, I am just retrieveing the "Owner Object" and creating a SelectionSet with the Block Name.

 

Thanks for the idea though - much appreciated.

 

Lee

Link to comment
Share on other sites

Thanks for the suggestion Buzzard, you know that I am always open to them - but in this case, I would rather stick to the tag selection method as it stands, as scouting for tag names is a bit of a palava, whereas currently, I am just retrieveing the "Owner Object" and creating a SelectionSet with the Block Name.

 

Thanks for the idea though - much appreciated.

 

Lee

No problem,

 

I thought I would mention it all the same since I was toying with the idea on the last program I had posted. I got it to work, But ran into problems with the default data of it. I really have not bothered with it since, But the program is set up to rotate attributes of different block name with a common tag and works well enough for me the way I posted it. You put together a kool program and it was just a thought.

Link to comment
Share on other sites

Cheers Buzzard.

 

I originally didn't want to create my own DCL file, and just be lazy and use the in-built AutoCAD DCL definitions - but when using the acad_mtprop definition, I got fed up of it saying "MTEXT Properties" instead of "Attribute Properties", so I just wrote my own :P

 

Lee

Link to comment
Share on other sites

Cheers Buzzard.

 

I originally didn't want to create my own DCL file, and just be lazy and use the in-built AutoCAD DCL definitions - but when using the acad_mtprop definition, I got fed up of it saying "MTEXT Properties" instead of "Attribute Properties", so I just wrote my own :P

 

Lee

 

Sooner or later we all get a bit worn out from the repetition of doing things over and over again. Maybe we just need sit back and let someone else carry the torch, But that may not happen anytime soon.

Link to comment
Share on other sites

Sorry for all the updates, but I have now added a "match" rotation ability for the RoAtt function and also fixed quite a few bugs... o:)

 

You can also now press "a" during the block selection to select all blocks, and the Advanced Text Editor Dialog is hopefully now free from bugs!

 

Lee

Link to comment
Share on other sites

Hi Lee,

 

:shock: Awesome Lisp !!

 

One thing for mvatt and roatt:

After selecting blocks, one needs to specifiy the base point.

When done, the second point is promted for.

If escape is pressed in between those 2 points it should cancel the command.

 

Cancelled it is, but the attributes do not flip back to their origins.

I guess it can be fixed by you. On the other hand "a control+z" does the job too. But since you are in for comments I thought I'd share it.

 

By the way, do you know what lisp stands for?

Me too but it could also be "Lee Is Splendid Programmer"

(We might start a topic on that one :D)

Cheers,

Marco.

 

Note: reply was written before version 5...

Nice Lisp with DCL inside.

Link to comment
Share on other sites

Hi Lee,

 

:shock: Awesome Lisp !!

 

One thing for mvatt and roatt:

After selecting blocks, one needs to specifiy the base point.

When done, the second point is promted for.

If escape is pressed in between those 2 points it should cancel the command.

 

Cancelled it is, but the attributes do not flip back to their origins.

I guess it can be fixed by you. On the other hand "a control+z" does the job too. But since you are in for comments I thought I'd share it.

 

By the way, do you know what lisp stands for?

Me too but it could also be "Lee Is Splendid Programmer"

(We might start a topic on that one :D)

Cheers,

Marco.

 

Note: reply was written before version 5...

Nice Lisp with DCL inside.

 

Thanks Marco :D

 

I'm loving that acronym... o:)

 

Good point about the MvAtt and RoAtt functions, I noticed that too - will have to attempt to fix it :P

 

Thanks for the suggestions and compliments ~ glad you like it mate :)

 

Lee

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...