Message 1 of 6
Open drawing - Either DWG or IDW based on Part number
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I have this Ilogic code, see below:
im oOccurrence As ComponentOccurrence Dim Prop As String Try oOccurrence = ThisDoc.Document.SelectSet.Item(1) Catch Ritnummer = iProperties.Value("Project", "Part Number") ThisDoc.Launch(Ritnummer + ".idw") Return End Try If TypeOf oOccurrence Is ComponentOccurrenceProxy Then Prop = iProperties.Value(oOccurrence.NativeObject.Name, "Project", "Part Number") Else Prop = iProperties.Value(oOccurrence.Name, "Project", "Part Number") End If 'Display Property in Msg Box Ritnummer = iProperties.Value(oOccurrence.Name, "Project", "Part Number") Try 'Try open a drawing with the same name as this model ThisDoc.Launch(Ritnummer + ".idw") Catch 'If no model is found show a message box MessageBox.Show("Hittar ej någon ritning för markerad del" & vbCrLf & "Ritningsnummer: " & iProperties.Value(oOccurrence.Name, "Project", "Description")& vbCrLf &"Modellnamn: " & Ritnummer , "FEL") End Try
For now, it only works for IDW's.
I would like to mod it to work also for DWG's. Basically, a loop that tries to open a dwg, if that fails, try to open aidw, if that also fails, give the messagebox that tells that there isnt a drawing.
How would that Ilogic look like? Im having a hard time figuring that loop out.
Best Regards
Alex