Titleblock macro to vb6
Titleblock macro to vb6
(OP)
trying to create vb version of titleblock ans stuck with setting up sheet format and getting part properties.
regarding to sheet format i need to set standard, sheet size and orientation. found same examples over the net but they don;t work.
also how do i get normal and added part properties?
this is not working
any help will be greatly appreciated.
cheers
regarding to sheet format i need to set standard, sheet size and orientation. found same examples over the net but they don;t work.
also how do i get normal and added part properties?
this is not working
CODE --> vb6
Dim ProductDrawn
Set ProductDrawn = Nothing
Dim DrwNo As StrParam
Set DrwNo = ProductDrawn.ReferenceProduct.UserRefProperties.Item("DRAWING No.").ValueAsString
Set MyTextDrwNo = MyDrawingViews.ActiveView.Texts.Add("" & DrwNo, 247.45, 14)
MyTextDrwNo.Name = "TitleBlock_Text_Title_8"
MyTextDrwNo.SetFontSize 0, 0, 2
MyTextDrwNo.SetFontName 0, 0, "Century Gothic (TrueType)"
MyTextDrwNo.AnchorPosition = catTopLeft any help will be greatly appreciated.
cheers





RE: Titleblock macro to vb6
CODE -->
then you go
CODE -->
Set DrwNo = ProductDrawn.ReferenceProduct.UserRefProperties.Item("DRAWING No.").ValueAsStringI am confused.. if ProductDrawn = Nothing how would you expect ProductDrawn.ReferenceProduct to give you anything?
indocti discant et ament meminisse periti
RE: Titleblock macro to vb6
any ideas about sheet setting?
RE: Titleblock macro to vb6
CODE --> vb6
Dim ProductDrawn As Product Set ProductDrawn = DrwSheet.Views.Item(3).GenerativeBehavior.Document Set MyText26 = MyDrawingViews.ActiveView.Texts.Add("DRAWING No.", 247.45, 14) 'MyText26.Name = "TitleBlock_Text_Title_8" MyText26.Name = "TitleBlock_Text_Title_8" MyText26.SetFontSize 0, 0, 2 MyText26.SetFontName 0, 0, "Century Gothic (TrueType)" MyText26.AnchorPosition = catTopLeft DrwTexts.GetItem("TitleBlock_Text_Title_8").Text = ProductDrawn.ReferenceProduct.UserRefProperties.Item("DRAWING No.").ValueAsStringthis code works well
RE: Titleblock macro to vb6
sheets numbering is driving me crazy
how do i get a current sheet number?
CODE --> vb6
the second question how do i search for a text thru all the sheets in the drawing?
this is only works for a current/active sheet
CODE --> vb6
Selection.Search "CATDrwSearch.DrwText,TitleBlock_Text_Title_8_all" DrwTexts.GetItem("TitleBlock_Text_Title_8").Text = ProductDrawn.ReferenceProduct.UserRefProperties.Item("DRAWING No.").ValueAsStringRE: Titleblock macro to vb6
Current Sheet Number:
Create separate Function to get the SheetNumber
CODE
Function GetSheetNumberOf(ByVal oDrawingSheet As DrawingSheet, ByVal oDrawingSheets As DrawingSheets) GetSheetNumberOf = GetSheetNumberOf (oDrawingSheet.Name, oDrawingSheets ) End Function Function GetSheetNumberOf(ByVal oDrawingSheetName As string, ByVal oDrawingSheets As DrawingSheets) Dim intSheetCounter As Integer = 0 If (oDrawingSheet IsNot Nothing) Then For Each oCurSheet As DrawingSheet In oDrawingSheets intSheetCounter += 1 If (oCurSheet.Name.Equals(oDrawingSheetName)) Then Exit For End If Next End If GetSheetNumberOf = intSheetCounter End Functioni hope Searching is like
CODE
Selection.Search "CATDrwSearch.DrwText.Name=*TitleBlock_Text_Title_8*, all"CODE
Regards,
Maddy
RE: Titleblock macro to vb6
CODE
Selection.Search "CATDrwSearch.DrwText.Name=*TitleBlock_Text_Title_8*, all" DrwText = selection.Item(1).Value DrwText.Text = ProductDrawn.ReferenceProduct.UserRefProperties.Item("DRAWING No.").ValueAsStringRegards,
Maddy
RE: Titleblock macro to vb6
function i will use later for title block update.
still got no luck with page setup. i can use catia page setup but in this way i lose the hole idea of my application.. i'm working on some drawing manager and moving all the actions from catscripts to the manager.
this will be something like this
RE: Titleblock macro to vb6
how can i add custom standard? probably have to edit some library. is it possible?
now the heaviest section called revision block. in the well known sample title block macro this works pretty well with a lot of functions
inside CatScript. is there a simplest way to create revisions block? revision block may be constructed by 2D geometry or table. when create revision button pressed next line should be created just below previous revision line/row.
this is works well except custom standard
CODE --> vb6
RE: Titleblock macro to vb6
Here's current code
CODE --> vb
'----FILLING PART PROPERTIES---- On Error Resume Next Set ProductDrawn = DrwSheet.Views.Item(3).GenerativeBehavior.Document '----DRAWING NUMBER---- Dim DrwNo As String DrwNo = ProductDrawn.ReferenceProduct.UserRefProperties.Item("DRAWING No.").ValueAsString Set MyTextDrwNo = MyDrawingViews.ActiveView.Texts.Add("DRAWING No.", 246.5, 14) MyTextDrwNo.Name = "TitleBlock_Text_Title_8" MyTextDrwNo.SetFontSize 0, 0, 2 MyTextDrwNo.SetFontName 0, 0, "Century Gothic (TrueType)" MyTextDrwNo.AnchorPosition = catTopLeft DrwTexts.GetItem("TitleBlock_Text_Title_8").Text = ProductDrawn.ReferenceProduct.UserRefProperties.Item("DRAWING No.").ValueAsString If (DrwNo <> "") Then Else Set MyTextDrwNo = Texts.GetItem("TitleBlock_Text_Title_8") VariableDrw = InputBox("DRW. No. NOT FOUND! PLEASE ENTER DRAWING NUMBER" & Chr(13) & _ " " & Chr(13) & _ "GO BACK TO PART PROPERTIES, FILL DRAWING NUMBER AND UPDATE TITLE BLOCK", "DRAWING NUMBER WARRING", "ENTER DRAWING NUMBER") MyTextDrwNo.Text = VariableDrw End Ifand so on for all the properties.
The method from sample CatScript which installed with Catia doesn't works for me.
Any help on that will be greatly appreciated.
Cheers.