ilogic form 2012

ilogic form 2012

jletcher
Advisor Advisor
2,363 Views
38 Replies
Message 1 of 39

ilogic form 2012

jletcher
Advisor
Advisor

Is there a way to get columns in form? I would like to put

 

 

Hole F Type { List the types}  Hole F Location {input box}

Hole N Type { List the types}  Hole N Location {input box}

Hole G Type { List the types}  Hole G Location {input box}

Can Or Not.JPG

 

If not this form will be off the monitor. Be ten miles long.

0 Likes
Accepted solutions (1)
2,364 Views
38 Replies
Replies (38)
Message 2 of 39

mrattray
Advisor
Advisor

Try playing around with the formating controls in the toolbox area. Groups and rows are what your interested in. It will take some practice to learn how to use them. Formating forms in iLogic is oversimplified to the point of being complicated. I'd much rather have a more VBesk form editor.

 

Capture.JPG

Mike (not Matt) Rattray

0 Likes
Message 3 of 39

jletcher
Advisor
Advisor

Yeah tried all those all they do is put them above or below in a group I would like to have them side by side or my form will be ten miles long.

0 Likes
Message 4 of 39

mrattray
Advisor
Advisor
Accepted solution

Here's an example of one of my iLogic forms:

 

Capture.JPG

 

 

I have my options organized into groups and then formated using rows:

 

Capture2.JPG

Mike (not Matt) Rattray

Message 5 of 39

jletcher
Advisor
Advisor

Dang that looks good well let me play with it more see what I can do the screen shot of your edit form will help..

0 Likes
Message 6 of 39

jletcher
Advisor
Advisor

may I ask what code you are using in the generate model?

0 Likes
Message 7 of 39

mrattray
Advisor
Advisor

Generate model runs an iLogic rule with over 1400 lines of code. What exactly are you looking for?

Mike (not Matt) Rattray

0 Likes
Message 8 of 39

jletcher
Advisor
Advisor

Yes I did not know those tricks thanks just what I wanted.

Yep.JPG

0 Likes
Message 9 of 39

jletcher
Advisor
Advisor

what I want to do is after the configure the part to do a save as or a save copy as.. This way it keeps the master.

0 Likes
Message 10 of 39

mrattray
Advisor
Advisor

Here's a snippet that executes a save as:

 

Dim fileName As String
Dim path As String

path = "path"
fileName = "fileName"

ThisDoc.Document.SaveAs(path & "\" & fileName & ".idw" , False)

 I use variables inside of the path and fileName variables that allow me to concoct a directory path and part number based file name. Obviously, substitute in the appropriate values for"path", "fileName" and ".idw". Keep the quotes. False does a save as, so it closes the master file and opens the new copy. If you want a save copy as, so the new file does not open, change False to True.

 

Mike (not Matt) Rattray

Message 11 of 39

jletcher
Advisor
Advisor

Sweet thanks give it a try whe I get back on it should be in day or two.

0 Likes
Message 12 of 39

jletcher
Advisor
Advisor

ok figured the saveas part I understand how it works. Question  I want them to be saved in current workspace but rember current workspace will change per job. so is there a code that will make the rule default to current workspace folder when doing saveas?

0 Likes
Message 13 of 39

jletcher
Advisor
Advisor

Lol never mind just found it. Works great. 

 

Now I need to find a way it prompts for filename..

 

Thanks for all your help

0 Likes
Message 14 of 39

mrattray
Advisor
Advisor

Look in the snippets, there's an inputbox command.

 

fileName = InputBox("Please enter a name for your file.", "File Name Input Box", "Default Name")

 

 

Mike (not Matt) Rattray

0 Likes
Message 15 of 39

jletcher
Advisor
Advisor

Yeah I got that far but for some reason it is not working but I'm looking like I said new to ilogic but loving it. they need a book on just ilogic.

 

Dim fileName As String
Dim path As String


path = ThisDoc.WorkspacePath()
fileName = InputBox("Please enter a name for your file.", "File Name Input Box", "Default Name")


ThisDoc.Document.SaveAs(path & "\" & "filename" & ".ipt" , False)

 

 

0 Likes
Message 16 of 39

jletcher
Advisor
Advisor

got it

Dim fileName As String
Dim path As String


path = ThisDoc.WorkspacePath()
fileName = "filename"

ThisDoc.Document.SaveAs(path & "\" & InputBox("Please enter a name for your file.", "File Name Input Box", "Default Name") & ".ipt" , False)

 

0 Likes
Message 17 of 39

mrattray
Advisor
Advisor

You had some stray quotes where they didn't belong.

 

Dim fileName As String
Dim path As String


path = ThisDoc.WorkspacePath()
fileName = InputBox("Please enter a name for your file.", "File Name Input Box", "Default Name")


ThisDoc.Document.SaveAs(path & "\" & fileName & ".ipt" , False)

 

Mike (not Matt) Rattray

0 Likes
Message 18 of 39

jletcher
Advisor
Advisor

I was looking at the sample code for derive. But **** looks as if it is for VBA I looked in snippits but found nothing on ilogic and derive.

 

I would like to have yes or no to create oppisite hand.

 

Tried to tale code from sample but I am have no luck.

 

Do you know a web site or anything I can look at or use snippits?

0 Likes
Message 19 of 39

mrattray
Advisor
Advisor

Can you post the sample you're trying to use?

Mike (not Matt) Rattray

0 Likes
Message 20 of 39

jletcher
Advisor
Advisor

Here is the whole code it is to take an assembly and make a mold using derive.

 

I was taking bits and parts of it to make what I need but I FAIL Smiley Embarassed

 

Thanks

 

Public Sub MoldBaseSample()
    ' Initialize the string that defines the directory where the 
    ' files will be created.
    Dim sFilePath As String
    sFilePath = "C:\Temp\"
    
    ' Call the functions to create the parts that represent the
    ' molded part and the mold base.
    Call CreateMoldPart(sFilePath & "MoldPart.ipt")
    Call CreateMoldBase(sFilePath & "MoldBase.ipt")
    
    ' Create a new part file to derive the mold part in.
    Dim oPartDoc As PartDocument
    Set oPartDoc = ThisApplication.Documents.Add(kPartDocumentObject, _
                 ThisApplication.FileManager.GetTemplateFile(kPartDocumentObject))
    
    ' Create a derived definition for the molded part.
    Dim oDerivedPartDef As DerivedPartUniformScaleDef
    Set oDerivedPartDef = oPartDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents.CreateUniformScaleDef(sFilePath & "MoldPart.ipt")
    
    ' Set the scale to use.
    oDerivedPartDef.ScaleFactor = 1.1
    
    ' We could set other options for the derived part using the derived part definition.
    ' In this case the defaults are good except for the scale which we changed.
    
    ' Create the derived part.
    Call oPartDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents.Add(oDerivedPartDef)
    
    ' Save and close the part.
    Call oPartDoc.SaveAs(sFilePath & "ScaledMoldPart.ipt", False)
    oPartDoc.Close
    
    ' Create a new assembly file to put the mold base and scaled part together.
    Dim oAsmDoc As AssemblyDocument
    Set oAsmDoc = ThisApplication.Documents.Add(kAssemblyDocumentObject, _
                ThisApplication.FileManager.GetTemplateFile(kAssemblyDocumentObject))
    
    ' Create the matrix used to define the position of the occurrences.  When a new
    ' matrix is created it is initialized to an identity matrix.  This will cause
    ' parts to be placed into the assembly in the same location that are in part space.
    Dim oMatrix As Matrix
    Set oMatrix = ThisApplication.TransientGeometry.CreateMatrix
    
    ' Place the mold base.
    Dim oOcc As ComponentOccurrence
    Set oOcc = oAsmDoc.ComponentDefinition.Occurrences.Add(sFilePath & "MoldBase.ipt", oMatrix)
    
    ' Rename the occurrence.  This sample uses the name to identify the occurrence later.
    ' This isn't the only method that could be used, but is one of the simplest.
    oOcc.Name = "Mold Base"
    
    ' Place the scaled part.
    Set oOcc = oAsmDoc.ComponentDefinition.Occurrences.Add(sFilePath & "ScaledMoldPart.ipt", oMatrix)
    oOcc.Name = "Mold Part"
    
    ' Save and close the assembly.
    Call oAsmDoc.SaveAs(sFilePath & "MoldSample.iam", False)
    oAsmDoc.Close
    
    ' Create a new part to derive the assembly into, subtracting the part from the mold base.
    Set oPartDoc = ThisApplication.Documents.Add(kPartDocumentObject, _
                 ThisApplication.FileManager.GetTemplateFile(kPartDocumentObject))
    
    ' Create a derived definition for the molded assembly.
    Dim oDerivedAsmDef As DerivedAssemblyDefinition
    Set oDerivedAsmDef = oPartDoc.ComponentDefinition.ReferenceComponents.DerivedAssemblyComponents.CreateDefinition(sFilePath & "MoldSample.iam")
    
    ' Set the part to be subtracted.
    oDerivedAsmDef.Occurrences.Item("Mold Part").InclusionOption = kDerivedSubtractAll
    
    ' Create the derived assembly.
    Call oPartDoc.ComponentDefinition.ReferenceComponents.DerivedAssemblyComponents.Add(oDerivedAsmDef)
End Sub


' Sub to create the part representing the molded part.
Private Sub CreateMoldPart(Filename As String)
    ' Create a new part document using the default part template.
    Dim oPartDoc As PartDocument
    Set oPartDoc = ThisApplication.Documents.Add(kPartDocumentObject, _
                 ThisApplication.FileManager.GetTemplateFile(kPartDocumentObject))
    
    ' Create a new sketch on the XY base workplane.
    Dim oSketch As PlanarSketch
    Set oSketch = oPartDoc.ComponentDefinition.Sketches.Add(oPartDoc.ComponentDefinition.WorkPlanes(3))
    
    Dim oTG As TransientGeometry
    Set oTG = ThisApplication.TransientGeometry
    
    ' Draw the geometry defining the shape of the part.
    Dim oPoints As ObjectCollection
    Set oPoints = ThisApplication.TransientObjects.CreateObjectCollection
    oPoints.Add oTG.CreatePoint2d(-5, 0)
    oPoints.Add oTG.CreatePoint2d(-4, 3)
    oPoints.Add oTG.CreatePoint2d(-2, 4)
    oPoints.Add oTG.CreatePoint2d(0, 3)
    oPoints.Add oTG.CreatePoint2d(3, 4)
    oPoints.Add oTG.CreatePoint2d(4, 2)
    oPoints.Add oTG.CreatePoint2d(5, 0)
   
    Dim oSpline As SketchSpline
    Set oSpline = oSketch.SketchSplines.Add(oPoints)
    oSpline.FitMethod = kSweetSplineFit
    
    Dim oLine As SketchLine
    Set oLine = oSketch.SketchLines.AddByTwoPoints(oSpline.FitPoint(1), oSpline.FitPoint(oSpline.FitPointCount))
    
    Dim oProfile As Profile
    Set oProfile = oSketch.Profiles.AddForSolid
    
    ' Create a revolved feature.
    Call oPartDoc.ComponentDefinition.Features.RevolveFeatures.AddFull(oProfile, oLine, kJoinOperation)
    
    ' Save and close the document.
    Call oPartDoc.SaveAs(Filename, False)
    oPartDoc.Close
End Sub


' Sub to create the part representing the mold base.
Private Sub CreateMoldBase(Filename As String)
    ' Create a new part document using the default part template.
    Dim oPartDoc As PartDocument
    Set oPartDoc = ThisApplication.Documents.Add(kPartDocumentObject, _
                 ThisApplication.FileManager.GetTemplateFile(kPartDocumentObject))
    
    ' Create a new sketch on the XY base workplane.
    Dim oSketch As PlanarSketch
    Set oSketch = oPartDoc.ComponentDefinition.Sketches.Add(oPartDoc.ComponentDefinition.WorkPlanes(3))
    
    ' Draw the geometry defining the shape of the part.
    Dim oTG As TransientGeometry
    Set oTG = ThisApplication.TransientGeometry
    Call oSketch.SketchLines.AddAsTwoPointRectangle(oTG.CreatePoint2d(-6, -5), oTG.CreatePoint2d(6, 5))
        
    Dim oProfile As Profile
    Set oProfile = oSketch.Profiles.AddForSolid
    
    ' Create an extruded feature.
    Call oPartDoc.ComponentDefinition.Features.ExtrudeFeatures.AddByDistanceExtent(oProfile, 5, kNegativeExtentDirection, kJoinOperation)
    
    ' Save and close the document.
    Call oPartDoc.SaveAs(Filename, False)
    oPartDoc.Close
End Sub

 

0 Likes