×
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

Switch off the Sketcher grid

Switch off the Sketcher grid

RE: Switch off the Sketcher grid

Drawing grid on/off is a user option that can be controlled by the CATSettings. I don't think it is controlled by automation.

RE: Switch off the Sketcher grid

(OP)
Hi Jackk,
Thanks for your quick response.I did not find any API help in any document nor did my macro get recorded when I switched off Drawing Grid .So,Do you think we cant do via coding?

RE: Switch off the Sketcher grid

Hi,

jackk is right up to a point. Sometime you need to do dirty workaround to achieve what you want.

CODE --> CATScript

Sub CATMain()

Dim settingControllers1 As SettingControllers
Dim settingRepository1 As SettingRepository
Dim boolean61 As Boolean

Set settingControllers1 = CATIA.SettingControllers
Set settingRepository1 = settingControllers1.Item("DraftingOptions")

boolean61 = settingRepository1.GetAttr("Drw_settings_GridDisplay")

If boolean61 Then
settingRepository1.PutAttr "Drw_settings_GridDisplay", False
Else
settingRepository1.PutAttr "Drw_settings_GridDisplay", True
End If

MsgBox settingRepository1.GetAttr("Drw_settings_GridDisplay")

settingRepository1.Commit

Dim drawingDocument1 As Document
Set drawingDocument1 = CATIA.ActiveDocument

Dim drawingSheets1 As DrawingSheets
Set drawingSheets1 = drawingDocument1.Sheets

Dim drawingSheet1 As DrawingSheet
Set drawingSheet1 = drawingSheets1.ActiveSheet

Dim drawingViews1 As DrawingViews
Set drawingViews1 = drawingSheet1.Views

Dim drawingView1 As DrawingView
Set drawingView1 = drawingViews1.Add("Tempo")

Dim drawingViewGenerativeBehavior1 As DrawingViewGenerativeBehavior
Set drawingViewGenerativeBehavior1 = drawingView1.GenerativeBehavior

drawingViewGenerativeBehavior1.DefineFrontView 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000

drawingView1.x = 0
drawingView1.y = 0

Dim double1 As Double
double1 = drawingSheet1.Scale

drawingView1.Scale = 1.000000
drawingView1.Activate 

Dim selection1 As Selection
Set selection1 = drawingDocument1.Selection

selection1.Search "Name=Tempo,all"

	Dim selection2 As Selection
	Set selection2 = drawingDocument1.Selection

 selection2.Delete

End Sub 

Regards
Fernando

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

RE: Switch off the Sketcher grid

(OP)
Hi Ferdo,
Thanks for your reply.I have written your code exactly but still the Sketcher grid did not turn off.I have a Active CATIA Drawing Document,I have written the below code.but nothing has been achieved
Waiting for your reply

Dim settingControllers1 As SettingControllers = CATIA.SettingControllers
Dim settingRepository1 As SettingRepository
settingRepository1 = settingControllers1.Item("DraftingOptions")
Dim boolean1 As Boolean
boolean1 = settingRepository1.GetAttr("Drw_settings_GridDisplay")
If boolean1 = True Then
settingRepository1.PutAttr("Drw_settings_GridDisplay", False)
Else
settingRepository1.PutAttr("Drw_settings_GridDisplay", True)
End If

settingRepository1.Commit()

RE: Switch off the Sketcher grid

(OP)
Hi Ferdo,
The best thing to do is to Use StartCommand()

I have just written this line:

CATIA.StartCommand("Display Grid")

RE: Switch off the Sketcher grid

(OP)
Sorry Ferdo.Initially,I thought its working,but Its not working..Please let me know the correct process for switching off Sketcher Grid.

Waiting for your reply

RE: Switch off the Sketcher grid

(OP)
I still dont know Why I am not able to switch off Sketcher Grid after running your code..Can you please tell me the reason and also Y is CATIA.StartCommand("Display Grid") not working here?

RE: Switch off the Sketcher grid

(OP)
Sorry Ferdo. I did not check it correctly.Thanks a Ton.Its working perfectly.

RE: Switch off the Sketcher grid

(OP)
Ferdo,Do you also have idea about CATIA CAA? I have few doubts in CAA..Can you help?

RE: Switch off the Sketcher grid

(OP)
Hi Ferdo,
Do you have idea of checking Clash,Contact and Clearance between two parts in CATIA..Also,a seconday screen is displayed when you select that Interference feature,Can we export that to "3DXML" File format?

I hope you understood what I meant

Waiting for your reply

RE: Switch off the Sketcher grid

(OP)
Hi Ferdo,
My License has been activated but When I am creating Interference features in a product,I am only able to export the whole product to "3DXML" file,I want to export individual Interference windows of 3DXML files..I hope you understand this ..If not,plese tell me so that I will sne dyou screenshots for your better understanding.

RE: Switch off the Sketcher grid

(OP)
Hi Ferdo,
In this Product,I have total of 3 parts.There exists a clash between Part 1 and Part 2 as well as a clash between Part 2 and Part 3.When you click on Interference feature 1,a second window pops up;I need to export this window to "3DXML" file. Please find the two Image files attached.First one shows the Interference features(Clash and Clash) in the Tree..

Waiting for your reply

RE: Switch off the Sketcher grid

(OP)
Hi Ferdo,
Second Image shows the CATIA Window of the Interference feature(i.e. the model showing only the clash between 2 parts).I want to export this particular window to 3DXML file.Please help me..Hope you understand what I mean.I have highlighted the window in red colour.



Thanking you

RE: Switch off the Sketcher grid

(OP)
Hi Ferdo,
For Clash Analysis,
This code is working perfectly :
Sub Main()

Dim CATIA As INFITF.Application
CATIA = GetObject(, "CATIA.Application")
If CATIA Is Nothing Then
CATIA = CreateObject("CATIA.Application")
End If

Dim cClashes As Clashes
Dim oSelection As Selection
oSelection = CATIA.ActiveDocument.Selection
Dim oProduct As AnyObject
oProduct = oSelection.FindObject("CATIAProduct")
cClashes = oProduct.GetTechnologicalObject("Clashes")
Dim oClash As Clash
oClash = cClashes.AddFromSel()
oClash.ComputationType = CatClashComputationType.catClashComputationTypeBetweenAll
oClash.InterferenceType = CatClashInterferenceType.catClashInterferenceTypeContact
oClash.Compute()
Dim cConflicts As Conflicts
cConflicts = oClash.Conflicts
Dim count As Integer
count = cConflicts.Count
Dim oConflict As Conflict
Dim Produs1 As Product
Dim oNume1 As String
Dim prod1run As Integer
Dim i As Integer
For i = 1 To count
oConflict = cConflicts.Item(i)
Produs1 = oConflict.FirstProduct
oNume1 = Produs1.PartNumber
If (UCase(Left(oNume1, 3)) = "RUN") Then
prod1run = prod1run + 1
End If

If (oConflict.Type = CatConflictType.catConflictTypeClash) Then
If (oConflict.Value <> 0) Then
oConflict.Status = CatConflictStatus.catConflictStatusRelevant
oConflict.Comment = "Automatic filter : penetration less than "
End If
ElseIf (oConflict.Type = CatConflictType.catConflictTypeContact) Then
oConflict.Status = CatConflictStatus.catConflictStatusIrrelevant
oConflict.Comment = "lalalalalala"
End If
Next
Dim iType As CatClashExportType = CatClashExportType.CatClashExportTypeXMLResultOnly
oClash.Export(iType, "c:\\Temp\ClashReport")
End Sub

End Module



I have 3 Queries:
1)For getting Clashes object,I am using oProduct.GetTechnologicalObject("Clashes")..I know that the method GetTechnologicalObject("Clashes") can be used only on the Root Product,Please help me to find the root Product from the Active Document because I dont want to manually select the root product everytime.
2)What if I have a root product consisting of 13-14 parts and I want to know clash report of each Part with other Parts? Then how should I modify my code
3)Once Interference feature is created in the model tree,If you click on that another window gets popup showing the exact Clash analysis of 2 parts..Will it be possible to export this particular window to "3DXML file"?..I Actually want to export each and every parts Clash analysis window to "3DXML files"

Waiting for your reply

Thank you

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