Jump to content

Sort individual rev blocks by date and map attributes to new title block


Da Ballz

Recommended Posts

Hey gang,

 

I have legacy drawings where the revision information lies in separate blocks, and I want to use a lisp to write the attribute values of those blocks to new title blocks with their own attributes.

 

The legacy block in question is named REVOLD. There are as many as a dozen copies of it in a given drawing, each with different attribute values for the following tags:

 

X (Revision number)

XX/XX/XX (Date)

XXX (Done by)

X (Revision description)

XX (Number associated with work order)

 

I know, it's atrocious. I need to map the attribute values of all instances of REVOLD to the following title blocks (depending on which one is in the drawing, also you can assume the new title block will already be in the legacy drawing because I will run that script before this one):

 

Drawing_Sheet_1

Drawing_Sheet_2

Drawing_Sheet_3

 

The attributes of the new title blocks are:

 

REV1

DATE1

APP1

DESC1

DCR1

 

REV2

DATE2

APP2

DESC2

DCR2

 

This pattern repeats up to 6 (but I'm only concerned with the first 4 for this entire problem)

 

To make things simple, I will only care about the last four (or four newest) REVOLD revisions. If there are more, I'll just discard them.

 

The attributes map one for one. For example: REV1 = X; DATE1 = XX/XX/XX, ect.

 

I will need to put the REVOLD attributes in date order so the earliest of the TOP 4 instances of REVOLD becomes REV1, the next instance REV2, and so on.

 

I hope that makes sense, I'll clarify more as need be.

Edited by Da Ballz
fix logic error
Link to comment
Share on other sites

Question (s):

If there are 4 revisions there are 4 REVOLD blocks?

After sorting pass the values to the NEW revision box on the new title block [ already inserted ]

After passing the value delete the REVOLD blocks?

What are the TAG names on the REVOLD blocks?

What is the format of the date? mm/dd/yy or dd/mm/yy?

 

 

Thoughts:

IF the REVOLD revisions are in a vertical position no need to sort by date. Having said that, "earliest of the TOP 4" means the first four from the bottom going up?

"I will only care about the last four (or four newest) REVOLD revisions."

 

 

IMO its easier to describe the problem via drawing sample. [ Delete ALL confidential information / or even a drawing with a similar condition showing before and after ]

Link to comment
Share on other sites

Answers:

 

1. There could be more than 4 revisions, but there is only so much space in the new title blocks.

Drawing_Sheet_1 can hold 6 revisions

Drawing_Sheet_2 can hold 4

Drawing_Sheet_3 can hold 4

 

2. Correct

 

3. I specified the REVOLD attribute tag names in my initial post. That's what all of those horrific X's are about. :(

 

4. The REVOLD date format is MM/DD/YY; the date format for the new title blocks is DD-MMM-YY (example: 29-DEC-15)

 

Thoughts Answers:

 

Yes. the REVOLD blocks are stacked on top of each other. The top one is the latest revision. You're right, I contradicted myself. What I need are the latest 4 REVOLD revisions, or in terms of date, the most recent 4 revisions.

 

I will scrub a drawing and attach as soon as I can...good point.

Link to comment
Share on other sites

pBe

 

This is essentially what I'm trying to fix over hundreds of drawings.

 

I need to map all of the REVOLD block's attribute values to the new title block with a lisp. Otherwise I have to basically hand jam each revision one by one, which will take forever considering there are literally hundreds of drawings.

Link to comment
Share on other sites

Couple of questions and some answers.

 

Is their only 1 layout sheet per dwg ?

 

I would probably make a list of the information depending on its length determines last 4 or less etc then update new block.

 

Its not off the shelf but its doable just need some time. Others step in !

Link to comment
Share on other sites

Bigal thank you.

 

Yes, there is only one title block per drawing, in paper space, on the default Layout1 tab.

 

I think a list might work fairly easily because although the tag names are different, the old attributes correspond with the new attributes perfectly. So the attribute values should transfer cleanly. I'm just not sure about how to map them in the correct order. I was originally thinking by date. You can see in the drawing that the oldest revision is on the bottom and they are stacked on top of each other.

Link to comment
Share on other sites

pBe

This is essentially what I'm trying to fix over hundreds of drawings.

 

On your sample drawing, Add Revision 5,6 & 7 from REVOLD after 4? or remove 4 entirely?

Before and after remember?

 

AND after transferring the data from OLD to NEW , update the REV tag as well correct?

Edited by pBe
Link to comment
Share on other sites

pBe, yes you would add those revisions in order above Rev 4. But I only showed Rev 4 as a sample of how the new title block revisions should look like.

 

In reality, the new title block will be blank, and you will start plugging in the first REVOLD revision at REV1, DESC1, ect, then add the rest in order until the new title block revisions are full or all the REVOLD revisions are transferred. Yes, update the REV tag to the match the latest (highest) revision.

Link to comment
Share on other sites

So its is normally blank? Do I need to add an option on the program if there are values already on the Titleblock ? and "bump" it down in case the revision boxes are full? How often does that happen?

 

Don't give up now, you are almost there. :)

Edited by pBe
Link to comment
Share on other sites

This is what i have so far. it would've been better if you post a reply now than later. [ today i had time to kill so here goes..

 

Conditions:

1 layout tab 1 titleblock

 

I threw in the option i mentioned on my previous posts regarding existing values on revision box....

 

Hope this helps

UpdateRevisionBox.LSP

Edited by pBe
Atatched the lisp file instead of code tags
Link to comment
Share on other sites

I already have a script to bump down revisions, great question though. What I plan on doing is throwing this code into my existing macro. This is the last piece of the puzzle...I think ;)

 

Sorry about not getting back earlier, I was asleep. We are probably on opposite sides of the globe.

 

Your code...wow! I will mess with it today as time permits and get back to you.

Link to comment
Share on other sites

pBe

 

Correct me if I'm wrong here. I notice that you define local functions in the main function.

 

But then, after defun five, I can't tell what happens. Is five one huge function? Or are there function definitions missing?

 

Also, I'm getting the error: malformed list on input. Upon debugging, I can't seem to find an obvious problem. I'll go through it line by line and see what I may have missed.

Link to comment
Share on other sites

But then, after defun five, I can't tell what happens. Is five one huge function? Or are there function definitions missing?

 

Five is just a sub to group a list into sets of five elements. the main function starts at

(and
     (setq RevoldColl nil
    ss (ssget  "_X" .....

Also, I'm getting the error: malformed list on input. Upon debugging, I can't seem to find an obvious problem.

 

I took out the code tags from my previous post and attached the lisp file instead. That way WYSIWYG.. no copy and paste on notepad .

 

I'll go through it line by line and see what I may have missed.

 

Make it so. :)

Link to comment
Share on other sites

All I have to say is wow pBe....

 

Good for you Da Ballz. Hope you'll learn from it.

 

...How long have you been programming in AutoLISP?

 

Too long as a mater of fact :D...

About around 2009 when I started fooling around [ really focusing that is ] with Visual and Vanilla lisp as well.

 

 

pBe

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