- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I`m pretty sure it is simple I just need a little help.
I have an iLogic assembly for 2 parts that make a stub up. Using form to configure it.
Here is the rules that make magic:
1st one makes sure that user saves it as new assembly, runs automatically when iam file is open.
'AC 2014 Stub up assembly configurator
Dim SFD As New SaveFileDialog()
SFD.InitialDirectory=ThisDoc.Path
SFD.Filter = "*.iam files (*.iam)|*.iam|All files (*.*)|*.*"
SFD.FileName="XXXXXTSA001"
PN=iProperties.Value("Project", "Part Number")
If PN<>"iStubup sleeve MASTER" Then
' do nothing
Else
MessageBox.Show("PLEASE SAVE IT AS DIFFERENT ASSEMBLY NUMBER, FORMAT [XXXXXTSA001], WHERE XXXXX IS JOB NUMBER", "WARNING",MessageBoxButtons.OK)
If SFD.ShowDialog()=DialogResult.OK Then
ThisDoc.Document.SaveAs(SFD.FileName , False)
iProperties.Value("Project", "Part Number")=ThisDoc.FileName(False) 'without extension
iLogicForm.Show("CONFIGURATOR")
End If
End If2nd code fires after user hits Apply or OK button on the form
'АЛЕКС ШМИДТ 2014 Stubup configurator
Imports System.Windows.Forms
Parameter("End1", "Width") = Width
Parameter("End1", "Height") = Height
Parameter("Side1", "Length") = Length
Parameter("Side1", "Height") = Height
Parameter("End1", "FlangeW") = FlangeW
Parameter("Side1", "FlangeW") = FlangeW
Parameter("End1", "ShThk") = ShThk
Parameter("Side1", "ShThk") = ShThk
iProperties.Value("Summary", "Title")=JobN & " STUB UP SLEEVE ASSEMBLY " & Length & """L X " & Width & """W X " & Height & """H"
Dim FBD As New FolderBrowserDialog()
FBD.SelectedPath=ThisDoc.WorkspacePath()
If FBD.ShowDialog()=DialogResult.ok Then
Parameter("End1", "FilePath") = FBD.SelectedPath
Parameter("End1", "FileName") = EndPN
Parameter("Side1", "FilePath") = FBD.SelectedPath
Parameter("Side1", "FileName") = SidePN
iLogicVb.RunRule("End1", "Adjusting")
iLogicVb.RunRule("Side1", "Adjusting")
iLogicVb.UpdateWhenDone = True
Component.Replace("End1", FBD.SelectedPath & "\" & EndPN & ".ipt", True)
Component.Replace("Side1", FBD.SelectedPath & "\" & SidePN & ".ipt", True)
' update all
iLogicVb.UpdateWhenDone = True
'zoom all
ThisApplication.ActiveView.Fit
End If
iLogicVb.RunRule("Area")
' ThE eNdEach ipt. "Side1", "End1" etc has an iLogic code that allowes to save it with a given in a form Part number.
'АЛЕКС ШМИДТ 2014
iProperties.Value("Project", "Creation Date") = Now user = ThisApplication.GeneralOptions.UserName iProperties.Value("Project", "Designer") = user iProperties.Value("Summary", "Author") = user iProperties.Value("Summary", "Title") = "END SLEEVE " & Width & " X " & Height iProperties.Value("Project", "Description")=iProperties.Value("Summary", "Title") If ShThk = 0.313 Then SheetMetal.SetActiveStyle("5/16"& Chr(34)) Else If ShThk = 0.25 Then SheetMetal.SetActiveStyle("1/4"& Chr(34)) Else If ShThk = 0.1345 Then SheetMetal.SetActiveStyle("10ga") Else If ShThk = 0.105 Then SheetMetal.SetActiveStyle("12ga") Else If ShThk = 0.1793 Then SheetMetal.SetActiveStyle("7ga") End If Try ThisDoc.Document.SaveAs(FilePath & "\" & FileName & ".ipt" , True) Catch Ex As exception ' do nothing End Try
Everything works just great.
I do have a master drawing, simple, 4 views with callouts and dim`s.
What I want is to open that drawing in the background, save it as the same assembly number and replace reference with newly configured assembly.
How I have to make a call from an iam file ?
I can open drawing using:
ThisDoc.Launch("c:\Work12\Designs\PARTS\iLogic tank parts\Stubup sleeve\iStubup sleeve MASTER.idw")
I do have a code to replace reference, but this works only form idw..
doc = ThisDoc.Document
Dim oFD As FileDescriptor
oFD = doc.ReferencedFileDescriptors(1).DocumentDescriptor.ReferencedFileDescriptor
oFD.ReplaceReference("C:\File Name.iam")
doc.Update()Any help is apreciated.. Thanks.
Solved! Go to Solution.