Showing posts with label all. Show all posts
Showing posts with label all. Show all posts

Friday, 20 November 2015

Defer Tube and Pipe Updates

I can understand why some of you might find this post boring and hard to read so I have sprinkled it with images from London Underground, mainly Tube Line Service Update and to be honest the first one matches my feeling and situation exactly.

My feeling exactly when Inventor T&P failed to update
                Being self taught is good and bad, and while I find solutions to my problems faster I do tend to be a know-it-all type of jerk that doesn’t take other people’s ideas and remarks easily.

                But what good is all this knowledge and skill if I don’t share the findings? On this premises today I will share a problem I had the other day and the solution I found for fixing this.

                On one of my large plant layouts I had to activate “Defer all Tube & Pipe Updates” so I can do changes to the equipment, foundation and the rest of the plant. Changing a single constraint can take forever on large assemblies especially if that implies updates to tube and pipe. On this particular job I had about 24 runs with multiple routes and even on decent CAD Workstation it can seem forever.

                So I’ve disabled updates on Tue and Pipe and I have started churning away on all the changes imposed by the client. Couple of days later when I finished I have decided it’s time to update some of the pipe routes. I usually work my way one route at a time, fixing connections, dimensions, and adding/removing elements. When I am happy with the results I turn to the next one but before I could even start I have hit a brick wall and couldn’t pass over it.




                I can’t seem to be able to turn off “Defer all Tube & Pipe Updates”. I right click the TP assembly node and choose “Tube & Pipe Settings”, tick off the option, click OK and ... nothing happens. No change of icons, they still are red lightning bolt, and the “Defer all Tube & Pipe Updates” is still marked on the T&P. First thought was to make a new TP asm and recreate the structure of all the Runs which will take a while because they are only 24 if you recall so I wasn’t really keen to do that.

It's like the Matrix deja-vu; keep ticking off and it's not working.


                First thing I tried was to open the T&P asm on a separate window and suppress all the runs, and for that I had to create a new Level Of Detail (LOD). Switched back to my original assembly and tried to change T&P representation to my new LOD and nothing happen. Stuck again I have decided to suppress the Runs from the main assembly, and now turning off “Defer all Tube & Pipe Updates” was working. Feeling that I am getting closer I tried to unsuppressed the RUNS and while they showed up they still had the red lightning bolt icon on them meaning that they might not update and cause problems down the road. I bet this is not just a glitch on the icon and I will have update problems in the future.

LOD not working either.

                I have turned back defer updates and suppressed the runs, then I started to un-supress them one at a time and to turn back on defer updates afterwards so I can track if there’s a specific run or set of runs that cause the problem.
                And I was right! One particular run once unsuppressed it didn’t allowed me to change T&P defer update settings. Using the same procedure I have narrow it down to a single route that was being my pain. Even though the route is displayed in red in the browser, which usually means there are some issues with it (not violations), I can’t seem to find what’s wrong with it. It is simple enough to be bulletproof; 8 lines fully constrained, and yet it’s acting weird.
Source of my problem.
Can't see what's wrong with it.
                Hope you never get the headache I have from T&P and hope you learned something new to try before starting over from scratch. A different solution might be to recreate the Tube and Pipe assembly altogether; just the T&P assembly though, not the routes and all that work, but I will be talking about that on a separate post.

Will end with Quote of the Day:




            Later,
ADS


Tuesday, 30 September 2014

Replace fitting error

I've seen a post the other day on the Autodesk Inventor forum regarding an error that the program throws when trying to replace fittings. The error is "Replace fitting error!"


You will notice if your parts are authored fittings if the thumbnail in the assembly browser looks like a blue tee.



In the assembly the commands "Replace" and "Replace all" are throwing the error.
The solution in this case is to restart inventor with the routed systems addin disabled. Once active it picks up on these parts and they can only be replaced with replace fitting command.




And the video:


Thursday, 21 August 2014

Save As PDF DWF iLogic

A while back I posted a blog about locating a certain project folder on the network before doing the PDF, DWF export. I used a simple ilogic command calling the saveas function:

ThisDoc.Document.SaveAs(strNameDWF & (".dwf") , True)
ThisDoc.Document.SaveAs(strNamePDF & (".pdf") , True)

Unfortunately as in the save as Inventor dialog it only saves the first sheet. On save as you need to click on options to choose all sheets as well as "print in colors" and dpi resolution.

So just as in the Save As dialog where you need to click options to export all sheets we need to add more complex code:





I wanted to have all sheets exported and the dwf file to contain a full 3d model for better visualization and markup.

Her's how the final code looks like:


' set the filepath of the contracts folder to start with.
strStartFolder = "G:\Commercial & Engineering\Engineering\Contracts\"
' get the filename without extension
oFileName = ThisDoc.FileName(False)  
'get the project type by reading the first 6 
'digits of the filename EX 105280 or 105281
strFolderType = ( Left (oFileName,6)) 
'get the last 3 digits of the project no start 
'after first 7 digits of filename Ex 005 or 109
strFolderNo = (Mid (oFileName,7, 3)) 
'get the first 9 digits to compose project 
'type and number Ex 105281005 or 105281109
strFolderProj = ( Left (oFileName,9)) 
'et the document revision to use in the new filename
oRevNum = iProperties.Value("Project", "Revision Number") 

'Set folder for project based on Contract No
If strFolderNo < "100" Then
strFolder3 = "\001-099\"
ElseIf strFolderNo >= "100" Then
strFolder3 = "\100-199\"
ElseIf strFolderNo >= "200" Then
strFolder3 = "\200-299\"
End If

'Find folder in start path that contains Folder Type string 
Dim dir1() As String = System.IO.Directory.GetDirectories _
(strStartFolder, strFolderType & "*")
'Add Contract No folder to our folder
Dim dir2 As String = String.Concat(dir1) & strFolder3

'Find folder in new path containing Folder Type 
Dim dir3() As String = System.IO.Directory.GetDirectories _
(dir2, strFolderProj & "*")
'Add Drawing folder to our path
dir4 = String.Concat(dir3) & "\Drawing\"
dir5 = String.Concat(dir4) & "\PDF"

' verify if foder exists, create if not
If Not System.IO.Directory.Exists(dir5) Then
    System.IO.Directory.CreateDirectory(dir5)
End If

'------------------- Complex code added to save all sheets    ----------------
oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById _
("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
oDWFAddIn = ThisApplication.ApplicationAddIns.ItemById _
("{0AC6FD95-2F4D-42CE-8BE0-8AEA580399E4}")
oDocument = ThisApplication.ActiveDocument
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

If oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
    oOptions.Value("All_Color_AS_Black") = 1
    oOptions.Value("Remove_Line_Weights") = 1
    oOptions.Value("Vector_Resolution") = 400
    'this publish all doens't work
    oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
    'try a different publish all command
    'oOptions.Value("Publish_All_Sheets") = 1
    'oOptions.Value("Custom_Begin_Sheet") = 2
    'oOptions.Value("Custom_End_Sheet") = 4
End If

 'Set the PDF target file name
oDataMedium.FileName = dir5 & "\" & oFileName & "_Rev" & oRevNum & ".pdf"
'Publish document
oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
i = MessageBox.Show("View the PDF file?", "Title",MessageBoxButtons.YesNo)
If i = vbYes Then : launchviewer = 1 : Else : launchviewer = 0 : End If 
If launchviewer = 1 Then ThisDoc.Launch(oDataMedium.FileName)


If oDWFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
    oOptions.Value("Launch_Viewer") = launchviewer
    oOptions.Value("Publish_All_Component_Props") = 1
    oOptions.Value("Publish_All_Physical_Props") = 1
    oOptions.Value("Password") = 0
    oOptions.Value("Publish_3D_Models") = Publish_3D_Models
    If TypeOf oDocument Is DrawingDocument Then
        Dim oSheets As NameValueMap
        oSheets = ThisApplication.TransientObjects.CreateNameValueMap
        oOptions.Value("Publish_Mode") = DWFPublishModeEnum.kCustomDWFPublish
        oOptions.Value("Publish_All_Sheets") = 1
        ' Publish the first sheet AND its 3D model
        Dim oSheet1Options As NameValueMap
        oSheet1Options = ThisApplication.TransientObjects.CreateNameValueMap
        oSheet1Options.Add("Name", "Sheet:1")
        oSheet1Options.Add("3DModel", True)
        oSheets.Value("Sheet1") = oSheet1Options
    End If
End If

 'Set the DWF target file name
oDataMedium.FileName = dir4 & oFileName & "_Rev" & oRevNum & ".dwf"
'Publish document
oDWFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
i = MessageBox.Show("View the DWF file?", "Title",MessageBoxButtons.YesNo)
If i = vbYes Then : launchviewer = 1 : Else : launchviewer = 0 : End If 
If launchviewer = 1 Then ThisDoc.Launch(oDataMedium.FileName)
'------------------- End Complex code added In To save all sheets --------------


Again, thanks to Curtis Waguespack for his code that I've used here. Check his blog, he even has a code that does batch export for all components of an assembly.

Best of luck.
ADS.