Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Does anyone have this page?

15 REPLIES 15
SOLVED
Reply
Message 1 of 16
jletcher
733 Views, 15 Replies

Does anyone have this page?

Trying to look at sample but not workinging...

 

 Can you post this code so I can see if I can get ilogic to do it..

 

Have.JPG

 

errror.JPG

 

 Thanks..

15 REPLIES 15
Message 2 of 16
jletcher
in reply to: jletcher

Autodesk how about stepping up and sending me this page seeing how it is your help not working..

 

  Thanks

Message 3 of 16
Robert..F
in reply to: jletcher
Message 4 of 16
jletcher
in reply to: Robert..F

Thanks I will give it a look at and let you know..

Message 5 of 16
wayne.brill
in reply to: jletcher

Hi James,

 

In your original post on this thread what was the link to the help file you were using?

I am not sure what that example is from the screenshot and I am not sure why the link did not work.

 

The Inventor API help is installed in a directory like this by default:

"C:\Program Files\Autodesk\Inventor 2014\Local Help\admapi_18_0.chm"

 

Also you can download the Inventor UI help (includes iLogic topics) from here:

http://usa.autodesk.com/adsk/servlet/index?id=16463987&siteID=123112

 

Thanks,

Wayne



Wayne Brill
Developer Technical Services
Autodesk Developer Network

Message 6 of 16
jletcher
in reply to: wayne.brill

I don't have 2014 loaded the help files in 2012 are not working I downloaded the offline version and that don't even work that is the page I posted. There are a lot of pages that don't work in the offline version just like the installed version.

I really wish you guy would get back on track I cannot believe how bad Autodesk has messed up such a great program. Makes me wonder if Autodesk even cares any more...
Message 7 of 16
xiaodong_liang
in reply to: jletcher

Hi James,

sorry, did you mean the local help file of Inventor 2014 API cannot be opened on a machine with Inventor 2012 installed only?

In addition, as my colleague Wayne asked: in your original post on this thread what was the link to the help file you were using? We are not clear which link you are talking about.

Could you paste the link here? We can take a look what would happen at our side. Thanks.
Message 8 of 16
jletcher
in reply to: xiaodong_liang

I am using 2012 only no 2014 loaded.......

 

 Pick one 60% of the links in the API help don't work the one circled in my 1st post is just one most of the imate links don't work.

 

 If you are in the ilogic edit in Inventor the help icon don't even work.  You can click it the hour glass pops up after 2 minutes of waiting nothing..

 

 

 I could never get help to work in inventor so I had to download the offline version and it don't even work.

 

 

  Autodesk has totally mess up when the changed to this wiki help.... But what else is new so far in the last 3 years of releases of Inventor it has went down hill.

 

  I really don't know what to say any more I am in the Beta test for 2015 and so far I am not happy with that..

 

  Just sad really, you guys have me thinking of a career change and I loved what I was doing ....

 

Message 9 of 16
wayne.brill
in reply to: jletcher

Hi James,

 

Can you provide the link to the 2012 help file you are using? I would like to download it and try to recreate the problems you having. At this time I don't have Inventor 2012 installed. (just 2013 and 2014)

 

Also do you have the Inventor API help as a chm file? It is installed on my machine in this directory. (this is for 2013 I believe 2012 was similar)
C:\Program Files\Autodesk\Inventor 2013\Local Help\admapi_17_0.chm

 

Maybe using the local chm file will work ok.

 

Wayne



Wayne Brill
Developer Technical Services
Autodesk Developer Network

Message 10 of 16
jletcher
in reply to: wayne.brill

That is what I am trying to use.

 

"C:\Program Files\Autodesk\Inventor 2012\Help_Lite\admapi_16_0.chm"

 

 Thats is my link....

 

 Here are some of the help that don't work the ones with red mark don't work..

 

red.JPG

 

 

That's 5 out of 8 that don't work not good odds..

Message 11 of 16
wayne.brill
in reply to: jletcher

Hi James,

 

Can you tell me the size of that admapi_16_0.chm?

 

On my system the 2013 admapi_17_0.chm file is 11,563KB and is all self contained. I am able to navigate to any of the topics instantly. If you don't have a chm file for 2012 that works like this I could send you the 2013 version.

 

Also you mentioned that you have the beta for Inventor 2015. Do you find a admapi_19_0.chm file?

 

Thanks,

Wayne



Wayne Brill
Developer Technical Services
Autodesk Developer Network

Message 12 of 16
jletcher
in reply to: wayne.brill

File size is 17,315 KB

 

 I will have to look when I get home for the other.

 

  I am at a client site right now..

 

 

Message 13 of 16
MegaJerk
in reply to: jletcher

So looking this over, and figured I would attempt to help by opening up MY help file and pulling it from there, only to find that it was also missing from my help file... 

But, being a curious Jerk, I decided to get my hands dirty figuring it out on my own. Because it was not as easy as I had anticipated, and because JLetch is using the same Inventor version as I am, I decided to make a functional example zip file that contains a small test assembly (with 2 parts), and an iLogic Rule that is commented (hopefully) well enough to explain all of the Component Pattern types that there are. 

I know that it isn't the page that you're looking for, but I figured that if anyone else ever attempted to find an example of this, it would help to go on and post it all in one place. 

Hope this solves it for ya. 

Assembly / Part files are Attached 

Below is the iLogic Code that I'm using (*Mind the line breaks, if the text window shrinks)  : 

Public Sub Main()
    
    ' Test to make sure this is being run from an Assembly Document
    
    If ThisApplication.ActiveDocument.DocumentType <> kAssemblyDocumentObject Then
        Exit Sub
    End If
    
    ' Creating the objects that represent our Active Assembly Document
    ' and our Component Definition object
    
    Dim oDoc As AssemblyDocument
    oDoc = ThisApplication.ActiveDocument
    
    Dim oCompDef As AssemblyComponentDefinition
    oCompDef = oDoc.ComponentDefinition
    
    ' If we've used this code before, then we want to clear out
    ' any patterns that we've made thus far.
    
    While oCompDef.OccurrencePatterns.Count > 0
        oCompDef.OccurrencePatterns.Item(1).Delete
    End While
    
    ' Because this is a test, some of the information below will be
    ' slightly more hard-coded than what you would expect to see in
    ' production. This test requires no user interaction.
    
    ' We need to define our two Components, and the ComponentDefinition
    ' for the one part that contains the features that we'd like to use
    ' to build our Associative Feature Assembly Pattern from.
        
    Dim patternOcc As ComponentOccurrence
    Dim featureOcc As ComponentOccurrence
    Dim oPartCompDef As PartComponentDefinition
    
    ' In this test we only use the Rectangular Pattern Feature, though
    ' I have taken the liberty to establish a few placeholders for
    ' the Circular Pattern Feature / Proxy, they can be ignored.
    
    ' The Proxy Geometry is only used if we end up wanting to create
    ' an Associative Feature Pattern, however it must exist if we do.
    
    ''' *****************************************************************
    ''' * To read more about Proxies, search for 'Proxies' (without quotes)
    ''' * in the Index of the Inventor API Help File. You can also find
    ''' * the page directly by going to the Overview Articles page, and
    ''' * clicking on Objects in Context - Proxies in the General Concepts
    ''' * listing.
    ''' *****************************************************************
    
    Dim oProxyObject As Object
    
    Dim oRectPatternFeature As RectangularPatternFeature
    Dim oRectPatternFeatureProxy As RectangularPatternFeatureProxy
    
    Dim oCircPatternFeature As CircularPatternFeature
    Dim oCircPatternFeatureProxy As CircularPatternFeatureProxy
    
    ' We still need to actually point to our part occurrences, and we
    ' do so below.
    
    patternOcc = oCompDef.Occurrences.ItemByName("Part2:1")
    featureOcc = oCompDef.Occurrences.ItemByName("Part1:1")
    
    ' Let's allow the user to choose the Pattern Type.
    
    Dim patternType As String
    Dim patternTypes(2) As String
	
	patternTypes(0) = "Rectangular"
	patternTypes(1) = "Circular"
	patternTypes(2) = "Associative"
	
	patternType = InputListBox("Please select a Pattern Type", patternTypes, patternTypes, Title := "Pattern Selector", ListName := "Pattern Types")
	
	If patternType = "" Then 
		MessageBox.Show("You didn't select anything! What's wrong with you?", "You've Hurt Inventor's Feelings :(")
		Exit Sub 		
	End If 

    
    ' Feel free to cheat and skip this If / Then statement, if you're
    ' not ready to learn about / deal with the Associative Feature Pattern
    ' Type / Proxy Geometry. :D
    
    If patternType = "Associative" Then
    
        ' Here we are hard coding it so that it grabs the only feature pattern
        ' that exists on the part. In this scenario, the oCircPatternProxy is
        ' never needed.
        
        oPartCompDef = featureOcc.Definition
        oRectPatternFeature = oPartCompDef.Features.RectangularPatternFeatures.Item(1)
        
        ' Now we need to make our Proxy Geometry!
        ' Pay attention to this step. We create the proxy using the method that
        ' is found on the Part Occurrence, which is found inside of the Occurrence
        ' list in our Assembly! This essentially gives us some geometrical context
        ' that jives on the Assembly level, rather than pertaining to the specifics
        ' of the Part Geometry.
        
        Call featureOcc.CreateGeometryProxy(oRectPatternFeature, oRectPatternFeatureProxy)
        
        ' Because in the real world, you could end up with either a Circular Pattern Feature
        ' or a Rectangular, and because I want to end up using only ONE call statement to my
        ' sub-routine, we will make oProxyObject = the one defined proxy objects out of the
        ' two (despite the fact that we already know that we're defining only ONE in this
        ' example.
    
        
        
        If Not oCircPatternFeatureProxy Is Nothing Then
            oProxyObject = oCircPatternFeatureProxy
            Else
            oProxyObject = oRectPatternFeatureProxy
        End If
    End If
    
    ' Let's take all of the information gathered above and send it off to a Sub-Routine
    ' that actually makes the pattern.
    
    Call CreatePattern(patternType, oDoc, patternOcc, oProxyObject)
    
End Sub

' This Sub requires a String with the user selected Pattern Type, the Assembly our Parts reside in, the Occurrence that we wish to Pattern,
' and the Geometry Proxy that we created if the user decided to create an Associative Feature Pattern.

Public Sub CreatePattern(targetPatternType As String, targetAssembly As AssemblyDocument, targetOcc As ComponentOccurrence, targetProxy As Object)
    
    ' Because this test requires no human interaction, we need to state
    ' the direction of our soon to be made patterns. In this case I have opted
    ' to use the default Work-Axes to do this.
    
    Dim axisX As WorkAxis
    Dim axisY As WorkAxis
    Dim axisZ As WorkAxis
    
    ' At this point I decided that I would attempt to make a Golden Axe joke because there aren't enough
    ' Golden Axe references in iLogic Code examples, but it fell a bit flat. Perhaps next time...

    Dim goldenAxis As WorkAxis
    
    ' This loops through all of the axes in our assembly, and will assign
    ' our variables above to the appropriate axis.
    
    For Each goldenAxis In targetAssembly.ComponentDefinition.WorkAxes
        Select Case goldenAxis.Name
        Case "X Axis"
            axisX = goldenAxis
        Case "Y Axis"
            axisY = goldenAxis
        Case "Z Axis"
            axisZ = goldenAxis
        End Select
    Next
    
    ' Just like how our Associative Feature Pattern requires the Proxy Geometry of the
    ' feature used to guide the pattern, ALL patterns need a similar reference to the
    ' occurrences that will be patterned.
    '
    ' This is done much with many of the same intentions as the Proxy stuffs. We can't
    ' simply tell the assembly that we want to pattern an occurrence, without any context
    ' of what that occurrence is doing in regards to our Assembly. The ObjectCollection
    ' is simply an easy way of storing several objects (in this case - Occurrences) in
    ' one easy to find place.
    
    ''' *****************************************************************
    ''' * To learn more about geometry & the API in Inventor, refer to the following link:
    ''' * http://modthemachine.typepad.com/files/mathgeometry.pdf
    ''' *****************************************************************
    
    Dim oObCollection As ObjectCollection
    oObCollection = ThisApplication.TransientObjects.CreateObjectCollection

    ' In this test, we only add one Occurrence.
    
    Call oObCollection.Add(targetOcc)
    
    ' Below we create an easy entry point for creating a new Pattern.
    
    Dim oOccPatterns As OccurrencePatterns
    oOccPatterns = targetAssembly.ComponentDefinition.OccurrencePatterns
    
    ' Based on the user's selection, we'll create a specific type of Pattern.
    
    Select Case targetPatternType
        Case "Rectangular"
            
            ' Note that this is using the X and Y axis as guides, and shows the range of how math behaves
            ' for this Pattern Method. Please reference the OccurrencePatterns portion of the Inventor API Help
            ' file for a full listing and explanation of what each argument pertains to.
            
            ' Note : If you wanted to have only a single direction Rectangular Pattern, you would end up
            ' with something that looks like :
            '
            ' Call oOccPatterns.AddRectangularPattern(oObCollection, axisX, True, 2.54, 3)
            
            Call oOccPatterns.AddRectangularPattern(oObCollection, axisX, True, 2.54, 3, axisY, True, "5 in", "3 ul")
        Case "Circular"
        
            ' WOW! That's a lot of instances! I did this to show just how Inventor is patterning out
            ' the elements inside of a Circular Pattern. If you were to use the Angle Measuring tool
            ' along the outside (or inside) edge of the part, you would see that they differ by the
            ' angle specified in the Angle Offset field. Play around with the values to see it work!
            
            Call oOccPatterns.AddCircularPattern(oObCollection, axisZ, False, "1 deg", "90 ul")
        Case "Associative"
        
            ' Because we do a lot of the work ahead of time to make sure that this Pattern works,
            ' it results in having the simplest of methods. It will result in the patterned elements
            ' mimicking the pattern of the feature specified way up in the code above.
            
            Call oOccPatterns.AddFeatureBasedPattern(oObCollection, targetProxy)
            
        Case Else
    End Select
End Sub

 
Below is the VBA version of the code above for debugging / stepping (* Difference in code comes down to the Pattern Selection window. There isn't one and it will need to be manually set in the code!!!) 

   Public Sub PatternTest()

    ' Test to make sure this is being run from an Assembly Document

    If ThisApplication.ActiveDocument.DocumentType <> kAssemblyDocumentObject Then
        Exit Sub
    End If

    ' Creating the objects that represent our Active Assembly Document
    ' and our Component Definition object

    Dim oDoc As AssemblyDocument
    Set oDoc = ThisApplication.ActiveDocument

    Dim oCompDef As AssemblyComponentDefinition
    Set oCompDef = oDoc.ComponentDefinition

    ' If we've used this code before, then we want to clear out
    ' any patterns that we've made thus far.

    While oCompDef.OccurrencePatterns.Count > 0
        oCompDef.OccurrencePatterns.Item(1).Delete
    Wend

    ' Because this is a test, some of the information below will be
    ' slightly more hard-coded than what you would expect to see in
    ' production. This test requires no user interaction.

    ' We need to define our two Components, and the ComponentDefinition
    ' for the one part that contains the features that we'd like to use
    ' to build our Associative Feature Assembly Pattern from.

    Dim patternOcc As ComponentOccurrence
    Dim featureOcc As ComponentOccurrence
    Dim oPartCompDef As PartComponentDefinition

    ' In this test we only use the Rectangular Pattern Feature, though
    ' I have taken the liberty to establish a few placeholders for
    ' the Circular Pattern Feature / Proxy, they can be ignored.

    ' The Proxy Geometry is only used if we end up wanting to create
    ' an Associative Feature Pattern, however it must exist if we do.

    ' *****************************************************************
    ' * To read more about Proxies, search for 'Proxies' (without quotes)
    ' * in the Index of the Inventor API Help File. You can also find
    ' * the page directly by going to the Overview Articles page, and
    ' * clicking on Objects in Context - Proxies in the General Concepts
    ' * listing.
    ' *****************************************************************

    Dim oProxyObject As Object

    Dim oRectPatternFeature As RectangularPatternFeature
    Dim oRectPatternFeatureProxy As RectangularPatternFeatureProxy

    Dim oCircPatternFeature As CircularPatternFeature
    Dim oCircPatternFeatureProxy As CircularPatternFeatureProxy

    ' We still need to actually point to our part occurrences, and we
    ' do so below.

    Set patternOcc = oCompDef.Occurrences.ItemByName("Part2:1")
    Set featureOcc = oCompDef.Occurrences.ItemByName("Part1:1")

    ' Let's allow the user to choose the Pattern Type.

    Dim patternType As String

    ' patternType = "Rectangular"
    ' patternType = "Circular"
    patternType = "Associative"

    ' Feel free to cheat and skip this If / Then statement, if you're
    ' not ready to learn about / deal with the Associative Feature Pattern
    ' Type / Proxy Geometry. :D

    If patternType = "Associative" Then

        ' Here we are hard coding it so that it grabs the only feature pattern
        ' that exists on the part. In this scenario, the oCircPatternProxy is
        ' never needed.

        Set oPartCompDef = featureOcc.Definition
        Set oRectPatternFeature = oPartCompDef.Features.RectangularPatternFeatures.Item(1)

        ' Now we need to make our Proxy Geometry!
        ' Pay attention to this step. We create the proxy using the method that
        ' is found on the Part Occurrence, which is found inside of the Occurrence
        ' list in our Assembly! This essentially gives us some geometrical context
        ' that jives on the Assembly level, rather than pertaining to the specifics
        ' of the Part Geometry.

        Call featureOcc.CreateGeometryProxy(oRectPatternFeature, oRectPatternFeatureProxy)

        ' Because in the real world, you could end up with either a Circular Pattern Feature
        ' or a Rectangular, and because I want to end up using only ONE call statement to my
        ' sub-routine, we will make oProxyObject = the one defined proxy objects out of the
        ' two (despite the fact that we already know that we're defining only ONE in this
        ' example.



        If Not oCircPatternFeatureProxy Is Nothing Then
            Set oProxyObject = oCircPatternFeatureProxy
            Else
            Set oProxyObject = oRectPatternFeatureProxy
        End If
    End If

    ' Let's take all of the information gathered above and send it off to a Sub-Routine
    ' that actually makes the pattern.

    Call CreatePattern(patternType, oDoc, patternOcc, oProxyObject)

End Sub

' This Sub requires a String with the user selected Pattern Type, the Assembly our Parts reside in, the Occurrence that we wish to Pattern,
' and the Geometry Proxy that we created if the user decided to create an Associative Feature Pattern.

Public Sub CreatePattern(targetPatternType As String, targetAssembly As AssemblyDocument, targetOcc As ComponentOccurrence, targetProxy As Object)

    ' Because this test requires no human interaction, we need to state
    ' the direction of our soon to be made patterns. In this case I have opted
    ' to use the default Work-Axes to do this.

    Dim axisX As WorkAxis
    Dim axisY As WorkAxis
    Dim axisZ As WorkAxis

    ' At this point I decided that I would attempt to make a Golden Axe joke because there aren't enough
    ' Golden Axe references in iLogic Code examples, but it fell a bit flat. Perhaps next time...

    Dim goldenAxis As WorkAxis

    ' This loops through all of the axes in our assembly, and will assign
    ' our variables above to the appropriate axis.

    For Each goldenAxis In targetAssembly.ComponentDefinition.WorkAxes
        Select Case goldenAxis.Name
        Case "X Axis"
            Set axisX = goldenAxis
        Case "Y Axis"
            Set axisY = goldenAxis
        Case "Z Axis"
            Set axisZ = goldenAxis
        End Select
    Next

    ' Just like how our Associative Feature Pattern requires the Proxy Geometry of the
    ' feature used to guide the pattern, ALL patterns need a similar reference to the
    ' occurrences that will be patterned.
    '
    ' This is done much with many of the same intentions as the Proxy stuffs. We can't
    ' simply tell the assembly that we want to pattern an occurrence, without any context
    ' of what that occurrence is doing in regards to our Assembly. The ObjectCollection
    ' is simply an easy way of storing several objects (in this case - Occurrences) in
    ' one easy to find place.

    ' *****************************************************************
    ' * To learn more about geometry & the API in Inventor, refer to the following link:
    ' * http://modthemachine.typepad.com/files/mathgeometry.pdf
    ' *****************************************************************

    Dim oObCollection As ObjectCollection
    Set oObCollection = ThisApplication.TransientObjects.CreateObjectCollection

    ' In this test, we only add one Occurrence.

    Call oObCollection.Add(targetOcc)

    ' Below we create an easy entry point for creating a new Pattern.

    Dim oOccPatterns As OccurrencePatterns
    Set oOccPatterns = targetAssembly.ComponentDefinition.OccurrencePatterns

    ' Based on the user's selection, we'll create a specific type of Pattern.

    Select Case targetPatternType
        Case "Rectangular"

            ' Note that this is using the X and Y axis as guides, and shows the range of how math behaves
            ' for this Pattern Method. Please reference the OccurrencePatterns portion of the Inventor API Help
            ' file for a full listing and explanation of what each argument pertains to.

            ' Note : If you wanted to have only a single direction Rectangular Pattern, you would end up
            ' with something that looks like :
            '
            ' Call oOccPatterns.AddRectangularPattern(oObCollection, axisX, True, 2.54, 3)

            Call oOccPatterns.AddRectangularPattern(oObCollection, axisX, True, 2.54, 3, axisY, True, "5 in", "3 ul")
        Case "Circular"

            ' WOW! That's a lot of instances! I did this to show just how Inventor is patterning out
            ' the elements inside of a Circular Pattern. If you were to use the Angle Measuring tool
            ' along the outside (or inside) edge of the part, you would see that they differ by the
            ' angle specified in the Angle Offset field. Play around with the values to see it work!

            Call oOccPatterns.AddCircularPattern(oObCollection, axisZ, False, "1 deg", "90 ul")
        Case "Associative"

            ' Because we do a lot of the work ahead of time to make sure that this Pattern works,
            ' it results in having the simplest of methods. It will result in the patterned elements
            ' mimicking the pattern of the feature specified way up in the code above.

            Call oOccPatterns.AddFeatureBasedPattern(oObCollection, targetProxy)

        Case Else
    End Select
End Sub

 



If my solution worked or helped you out, please don't forget to hit the kudos button 🙂
iLogicCode Injector: goo.gl/uTT1IB

GitHub
Message 14 of 16
jletcher
in reply to: MegaJerk

Thanks MegaJerk,

 

   Your sample helped out a lot MEGA THANKS.....

 

 

 

    Sad to see end users know more then the people that developed the software....

Message 15 of 16
MegaJerk
in reply to: jletcher

Clearly a perfect opportunity for Autodesk to outsource their code examples by hiring meeeeeeee! ❤️

Though I am happy that it helped you out, to be honest it was a rather compelling learning experience for myself as well. There were a few concepts like Proxies and Transient Geometry that made a little sense to me before doing this, that now make a whole lot more sense after having made this up, and that makes me rather happy as well.

Learning for everyone!



If my solution worked or helped you out, please don't forget to hit the kudos button 🙂
iLogicCode Injector: goo.gl/uTT1IB

GitHub
Message 16 of 16
jletcher
in reply to: MegaJerk

I give my vote for that you helped me out twice now.  Plus other post you made I learned things.

 

  Ever down in Florida look me up I owe you a beer....

 

 

  Again MEGA Thanks

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report