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!

Activate/Deactivate Frame in a Table

Status
Not open for further replies.

solid7

Mechanical
Jun 7, 2005
1,403
I have a drawing form that is based on a table. The cells in the sheet size column have a circular text frame added if the user specifies that the drawing is a CAD drawing, and no circle frame if it is a board drawing. I am looking for a way to programmatically add the frame, based on a simple reaction. (i.e., a pull down box, with a Boolean selection - if CAD = "true", a reaction is fired which applies the frame to the cell of the table)

My table is locked out to prevent users from modifying the parameter manually. Therefore, it is imperative that I find a method to accomplish this task.

Thank you.
 
Replies continue below

Recommended for you

OK, so I've tackled this from a different perspective, but still with some issues. I couldn't access the frame, but since the sheet is locked out, I just decided to use a circle. I figured that it would be easier to hide and show geometry. So I wrote this:

Code:
Sub CATMain()

Dim bSTR1

Set drawingDocument1 = CATIA.ActiveDocument
Set selection1 = drawingDocument1.Selection
Set visPropertySet1 = selection1.VisProperties
Set drawingSheets1 = drawingDocument1.Sheets
Set drawingSheet1 = drawingSheets1.Item("Sheet.1")
Set drawingViews1 = drawingSheet1.Views
Set drawingView1 = drawingViews1.Item("Background View")
Set geometricElements1 = drawingView1.GeometricElements
Set circle2D1 = geometricElements1.Item("Circle.2")
Set geometricElements1 = circle2D1.Parent
Set parameters1 = drawingDocument1.Parameters
Set boolParam1 = parameters1.Item("Boolean.2")

bSTR1 = circle2D1.Name

selection1.Add circle2D1

visPropertySet1.SetShow boolParam1.Value

selection1.clear

End Sub

However, it doesn't work properly. This code returns the exact opposite of what I'm asking it to. (if boolParam1 = true, it hides the circle, and vice versa)
 
I looked in the chm file under drawing documents and found the following:
Code:
oText.FrameType = catRectangle

It looks like the options for other frames are:
Code:
  catNone,
  catRectangle,
  catSquare,
  catCircle,
  catScoredCircle,
  catDiamond,
  catTriangle,
  catRightFlag,
  catLeftFlag,
  catBothFlag,
  catOblong,
  catEllipse,
  catCustom
 
Hi,

Glad to see you back , solid7 [smile] . Don't know if this will help you....

Code:
' ======================================================
' Purpose: Macro will add in a vertical column samples of text frames in an active view of a CATIA drawing
' Usage:   1 - A CATDrawing must be active   
'          2 - Run macro 
' Author: GVI (Disclaimer: You use this code at your own risk) 
' ======================================================
Sub CATMain()

Dim Drw As DrawingDocument
Dim Sh As DrawingSheet
Dim Vw As DrawingView
Dim Txt ' As DrawingText
Set Drw = CATIA.ActiveDocument
Set Sh = Drw.Sheets.ActiveSheet
Set Vw = Sh.Views.ActiveView
Dim i As Integer

For i = 0 To 21
Set Txt = Vw.Texts.Add(vbNullString, 20, 400 - 15 * i)
Txt.ActivateFrame i
Txt.Text = Txt.FrameType
Set Txt = Nothing
Next

End Sub

Regards
Fernando

- Romania
- EU
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor