×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Activate/Deactivate Frame in a Table

Activate/Deactivate Frame in a Table

Activate/Deactivate Frame in a Table

(OP)
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.

RE: Activate/Deactivate Frame in a Table

(OP)
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)

RE: Activate/Deactivate Frame in a Table

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 

RE: Activate/Deactivate Frame in a Table

Hi,

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

CODE --> CATScript

' ======================================================
' 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

https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources