Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Titleblock grid macro modification 2

Status
Not open for further replies.

harlowmatt

Aerospace
Nov 11, 2014
71
Hi everyone,

currently our titleblock has the letters at the top and bottom and the numbers at the left and right. I am wanting to reverse this. I am new to the macro game and am struggling to do this. attached is what I believe is the section of the titleblock macro for the grid numbers and letters. Any help is appreciated. Thanks.
 
 https://files.engineering.com/getfile.aspx?folder=fd230b5c-d594-4562-b241-4f179ea4fb62&file=titleblock_grid.docx
Replies continue below

Recommended for you

I did not understood the question. could you provide a picture?
 
Hi,

try these changes:
I have comment the original lines.
Code:
For i = Nb_CM_H To (Ruler/2/Cst_1 + 1) Step -1
    'CreateTextAF Chr(65 + Nb_CM_H - i) ,.5 * GetWidth() + (i - .5) * Cst_1,.5 * GetOffset(),"Frame_Text_Bottom_1_"&Chr(65 + Nb_CM_H - i), catMiddleCenter, 3.5
    'CreateTextAF Chr(64 + Nb_CM_H + i) ,.5 * GetWidth() - (i - .5) * Cst_1,.5 * GetOffset(),"Frame_Text_Bottom_2_"&Chr(65 + Nb_CM_H + i), catMiddleCenter, 3.5
    t=CStr(Nb_CM_H + i)
      CreateTextAF t ,.5 * GetWidth() + (i - .5) * Cst_1,.5 * GetOffset(),"Frame_Text_Bottom_1_"& t , catMiddleCenter, 3.5
	t=CStr(Nb_CM_H - i + 1)
      CreateTextAF t ,.5 * GetWidth() - (i - .5) * Cst_1,.5 * GetOffset(),"Frame_Text_Bottom_2_"& t, catMiddleCenter, 3.5
    Next
  
    For i = 1 To Nb_CM_H
      't=Chr(65 + Nb_CM_H - i)
      t=CStr(Nb_CM_H + i)
      CreateTextAF t,.5 * GetWidth() + (i - .5) * Cst_1,GetHeight() - .5 * GetOffset(),"Frame_Text_Top_1_"&t , catMiddleCenter, 3.5
      't=Chr(64 + Nb_CM_H + i)
      t=CStr(Nb_CM_H - i + 1)
      CreateTextAF t,.5 * GetWidth() - (i - .5) * Cst_1,GetHeight() - .5 * GetOffset(),"Frame_Text_Top_2_"&t , catMiddleCenter, 3.5
    Next

    For i = 1 To Nb_CM_V
      't=CStr(Nb_CM_V + i)
      t=Chr(65 + Nb_CM_V - i)
      CreateTextAF t ,GetWidth() - .5 * GetOffset(),.5 * GetHeight() + (i - .5) * Cst_2,"Frame_Text_Right_1_"&t , catMiddleCenter, 3.5
      CreateTextAF t  ,.5 * GetOffset() ,.5 * GetHeight() + (i - .5) * Cst_2,"Frame_Text_Left_1_"&t , catMiddleCenter, 3.5
      't=CStr(Nb_CM_V - i + 1)
      t=Chr(64 + Nb_CM_V + i)
      CreateTextAF t ,GetWidth() - .5 * GetOffset(),.5 * GetHeight() - (i - .5) * Cst_2,"Frame_Text_Right_1_"&t , catMiddleCenter, 3.5
      CreateTextAF t  ,.5 * GetOffset() ,.5 * GetHeight() - (i - .5) * Cst_2,"Frame_Text_Left_2"&t , catMiddleCenter, 3.5
    Next

Regards
Marc
 
Marc,

this is great! but I still need "1" & "A" to be in the bottom right.
 
In otherwords I need the numbers to read right to left and the letters to read bottom to top. thanks.
 
Hi,

Reverse these 2 lines :
t=Chr(64 + Nb_CM_V + i)
t=Chr(65 + Nb_CM_V - i)

Modified code:
Code:
    For i = 1 To Nb_CM_V
      't=CStr(Nb_CM_V + i)
      't=Chr(65 + Nb_CM_V - i)
	  t=Chr(64 + Nb_CM_V + i)
      CreateTextAF t ,GetWidth() - .5 * GetOffset(),.5 * GetHeight() + (i - .5) * Cst_2,"Frame_Text_Right_1_"&t , catMiddleCenter, 3.5
      CreateTextAF t  ,.5 * GetOffset() ,.5 * GetHeight() + (i - .5) * Cst_2,"Frame_Text_Left_1_"&t , catMiddleCenter, 3.5
      't=CStr(Nb_CM_V - i + 1)
      't=Chr(64 + Nb_CM_V + i)
	  t=Chr(65 + Nb_CM_V - i)
      CreateTextAF t ,GetWidth() - .5 * GetOffset(),.5 * GetHeight() - (i - .5) * Cst_2,"Frame_Text_Right_1_"&t , catMiddleCenter, 3.5
      CreateTextAF t  ,.5 * GetOffset() ,.5 * GetHeight() - (i - .5) * Cst_2,"Frame_Text_Left_2"&t , catMiddleCenter, 3.5
    Next

Regards
Marc
 
GREAT! got it working like I want now. thanks Marc.
 
Hello harlowmatt,
Can you post your complete code here, that will be of great help, I am looking for a code that will create a Table in complete sheet with zone name in each cell like from one corner A1 to end corner L40 . This code will help me to create table based on various sheet sizes.

Refer the image attached for my requirement.

Zone_Requirement_m1qnmg.png


Thank you,
Rangrao
 
Hello

If you don't know how to create a script to do this, it will be much easier (and faster) to create a 2D Component (ditto) to insert in a drawing and see the grid created with your own rules.

Is much easier to use the native CATIA tools and sometimes much faster than developing an application.

Regards
Fernando

- Romania
- EU
 
Rangrao,

the screen shot of mine that you used has information that I deleted. with our facility being ITAR CONTROLLED, all the fields are links, and our company logo linked to it I would have to go in and do quite a bit of modification to the macro. at this time I unable to spend that kind of time on it. my apologies.

 
Hello Ferdo,

Actually I want a macro that will create a bigger table like this, this will useful for me during Drawing revision recording and zone specification during each time. I am expecting a tool that will create such table that will be helpful for a moment during revision recording and will create another macro to delete it or getting hided.
I hope you understood my requirement.

Hello Harlowmat,
Thanks for your reply, anyway will create separate post for my requirement, while looking at your post just had a thought of my requirement. I understand being ITAR controlled data, one cannot share. We also have same situation.. :)

Thanks,
Rangrao
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor