Tuesday, 12 January 2016

Graphic Card Issues



Ever had ghosts showing up inside Inventor? I don't mean, dead people but parts that have been deleted, promoted-demoted, moved, rotated or constrained in a different place and yet when you spin, pan the assembly you see a silhouette shape of the component still hanging around?
Ghosts can be fixed with Rebuild All.

Well... that's an easy fix. Just hit Rebuild All (RE on my keyboard) on the Update Panel / Mange tab.
Rebuild All is your ghostbuster.

Ghosts I have and ready to accept but artifacts I don’t like and I will not accept unfortunately I had some the other day and they are usually predicting something going bad with the video card. I had two video cards going dead on separate laptops from both main manufacturers ATI (now AMD) and Nvidia (now Intel).

Artifacts look like a puzzle on the screen with random blocks of grey pixels, discontinued faces or scrambled content, like text from a different galaxy in on an old sci-fi movie.





The one I had just last week was in AutoCAD and (finger crossed) it's just a glitch and nothing bad will come out of it for it’s an expensive card and to service the workstation will take longer than passing a bill in congress.
 
AutoCAD issues, hope the card keeps working.
If you start having problems with Inventor, like seeing artifacts, graphics not responding, and jerky movements than the video card might be the issue and it might be older than you are willing to admit. You could try and update the video driver and if you already have the latest you can also try and install the certified version if you have an expensive enough video card for which certified drivers are usually done.
 
Inventor graphics issue.
If the problem still persists then there is a quick test you can do to verify if it’s time to ditch the card and get a new one (or a whole computer for that matter).

In you Application Options you can switch the Graphic Settings to Software Graphics and see if that fixes it. 

Click on Tools / Application Options / Hardware tab and select Software Graphics. If the problem is no more then you have the answer to your problem.

TIP: Software Graphics should never be used as your main video settings; it’s only meant to test and troubleshoot video card issues. 

Quick and dirty fix if the card is dying, is to bake it (search online how to), either yourself or take it a specialist with a heat gun. An even better fix is to do a re-balling which is a better temperature controlled melting of the contactors inside the video chip to get them back into their slots. I have done them both and forced the fan to always on and on high speed but unfortunately the laptops died again.

I hope you never run into these kind of problems but it’s good to know how to test it out.

Later,
ADS
photo credit: Where you gonna park? (license)

Friday, 8 January 2016

Batch Assembly Export

Not enough time today for a proper post just a quick one. I have been working on a vb-ilogic code to identify and resolve all references. On the same process I hope to get a code for renaming the files as well.

This will of course be free and available for everybody to download from this blog but you need to stick around and check my progress because I don’t have a time frame of when that will be available.

Replacing references is working but we get into errors and limitations for special files like skeletons in Frame Generator, Tube and Pipe Route and Runs, welded assemblies, documents marked as Reference in BOM, etc. It’s a slow progress and I can’t allocate it as much time as I would like at the moment.

On a side note, there is a NDA (Non Disclosure Agreement) between me and Autodesk so I can’t say much but I was assured that the T&P list is very important for them.

Enough said on that and for today I will share a bit of code that hopefully will get your productivity up and get those manual tasks to minimum. The code needs to be run from inside an assembly and will save all parts in STEP format in a folder right next to the main assembly. I have done this code for a friend and while he is still testing you can have a preview of it (hurry up Karol).

The SaveAs option in the code can be used with any formats listed in the Save Copy As dialog but you might want to investigate the results and use the ApplicationAddIns and HasSaveCopyAsOption which will give you more control over what gets exported and some of the options in the save as dialog.

The Save As dialog can be bypassed and process the assembly as a batch

If, for example, you need to export the current drawing to PDF you can’t (shouldn’t) use the SaveAs code because it will only export the first sheet and you can’t control, colors, resolution, line weights, printing sheet range, etc. There’s more info in my previous post here.

Here’s the code, enjoy:


 'define the active document as an assembly file
Dim oAsmDoc As AssemblyDocument
oAsmDoc = ThisApplication.ActiveDocument
oAsmName = ThisDoc.FileName(False) 'without extension

If ThisApplication.ActiveDocument.DocumentType <> kAssemblyDocumentObject Then
    MessageBox.Show("Please run this rule from the assembly file.", "iLogic")
    Exit Sub
End If
'get user input
RUsure = MessageBox.Show ( _
"This will create a STEP file for all components." _
& vbLf & " " _
& vbLf & "Are you sure you want to create STEP Drawings for all of the assembly components?" _
& vbLf & "This could take a while.", "iLogic - Batch Output STEPs ",MessageBoxButtons.YesNo)
If RUsure = vbNo Then
    Return
Else
End If
'- - - - - - - - - - - - -STEP setup - - - - - - - - - - - -
oPath = ThisDoc.Path
'get STEP target folder path
oFolder = oPath & "\" & oAsmName & " STEP Files"
'Check for the step folder and create it if it does not exist
If Not System.IO.Directory.Exists(oFolder) Then
System.IO.Directory.CreateDirectory(oFolder)
End If


'- - - - - - - - - - - - -Assembly - - - - - - - - - - - -
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".stp") , True)

'- - - - - - - - - - - - -Components - - - - - - - - - - - -
'look at the files referenced by the assembly
Dim oRefDocs As DocumentsEnumerator
oRefDocs = oAsmDoc.AllReferencedDocuments
Dim oRefDoc As Document
'work the referenced models
For Each oRefDoc In oRefDocs
    Dim oCurFile As Document
    oCurFile = ThisApplication.Documents.Open(oRefDoc.FullFileName, True)
    oCurFileName = oCurFile.FullFileName
   
    'defines backslash As the subdirectory separator
    Dim strCharSep As String = System.IO.Path.DirectorySeparatorChar
   
    'find the postion of the last backslash in the path
    FNamePos = InStrRev(oCurFileName, "\", -1)  
    'get the file name with the file extension
    Name = Right(oCurFileName, Len(oCurFileName) - FNamePos)
    'get the file name (without extension)
    ShortName = Left(Name, Len(Name) - 4)

    Try
        oCurFile.SaveAs(oFolder & "\" & ShortName & (".stp") , True)
    Catch
        MessageBox.Show("Error processing " & oCurFileName, "ilogic")
    End Try
    oCurFile.Close
Next
'- - - - - - - - - - - - -
MessageBox.Show("New Files Created in: " & vbLf & oFolder, "iLogic")
'open the folder where the new files are saved
Shell("explorer.exe " & oFolder,vbNormalFocus)



I have tested it and save the assembly in all these other formats, including Inventor iam:

Results of exporting the assembly.
 
'- - - - - - - - - - - - -Assembly - - - - - - - - - - - - 
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".iam") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".dwg") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".bmp") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".CATProduct") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".dwf") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".dwfx") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".gif") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".igs") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".ige") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".iges") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".jpg") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".jt") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".pdf") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".png") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".x_b") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".x_t") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".g") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".neu") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".sat") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".stp") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".ste") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".step") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".stl") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".tiff") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".xgl") , True)
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName &(".zgl") , True)


Later,
ADS


Edit 16-04-14

this is the code to append revision number at the end of the files:




Dim oAsmDoc As AssemblyDocument
oAsmDoc = ThisApplication.ActiveDocument
oAsmName = ThisDoc.FileName(False) 'without extension

If ThisApplication.ActiveDocument.DocumentType <> kAssemblyDocumentObject Then
    MessageBox.Show("Please run this rule from the assembly file.", "iLogic")
    Exit Sub
End If
'get user input
RUsure = MessageBox.Show ( _
"This will create a STEP file for all components." _
& vbLf & " " _
& vbLf & "Are you sure you want to create STEP Drawings for all of the assembly components?" _
& vbLf & "This could take a while.", "iLogic - Batch Output STEPs ",MessageBoxButtons.YesNo)
If RUsure = vbNo Then
    Return
Else
End If
'- - - - - - - - - - - - -STEP setup - - - - - - - - - - - -
oPath = ThisDoc.Path
'get STEP target folder path
oFolder = oPath & "\" & oAsmName & " STEP Files"

'get the document revision to use in the new filename
oRevNumAsm = iProperties.Value("Project", "Revision Number")

'Check for the step folder and create it if it does not exist
If Not System.IO.Directory.Exists(oFolder) Then
System.IO.Directory.CreateDirectory(oFolder)
End If


'- - - - - - - - - - - - -Assembly - - - - - - - - - - - -
ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName & "_Rev" & oRevNumAsm &(".stp") , True)

'- - - - - - - - - - - - -Components - - - - - - - - - - - -
'look at the files referenced by the assembly
Dim oRefDocs As DocumentsEnumerator
oRefDocs = oAsmDoc.AllReferencedDocuments
Dim oRefDoc As Document
'work the referenced models
For Each oRefDoc In oRefDocs
    Dim oCurFile As Document
    oCurFile = ThisApplication.Documents.Open(oRefDoc.FullFileName, True)
    oCurFileName = oCurFile.FullFileName

   
    'defines backslash As the subdirectory separator
    Dim strCharSep As String = System.IO.Path.DirectorySeparatorChar
   
    'find the postion of the last backslash in the path
    FNamePos = InStrRev(oCurFileName, "\", -1)  
    'get the file name with the file extension
    Name = Right(oCurFileName, Len(oCurFileName) - FNamePos)
    'get the file name (without extension)
    ShortName = Left(Name, Len(Name) - 4)
    oRevDoc = iProperties.Value(Name, "Project", "Revision Number")


    Try
        oCurFile.SaveAs(oFolder & "\" & ShortName & "_Rev" & oRevDoc & (".stp") , True)
    Catch
        MessageBox.Show("Error processing " & oCurFileName, "ilogic")
    End Try
    oCurFile.Close
Next
'- - - - - - - - - - - - -
MessageBox.Show("New Files Created in: " & vbLf & oFolder, "iLogic")
'open the folder where the new files are saved
Shell("explorer.exe " & oFolder,vbNormalFocus)