How to determine the "form factor" of a part

How to determine the "form factor" of a part

RNDinov8r
Collaborator Collaborator
1,069 Views
14 Replies
Message 1 of 15

How to determine the "form factor" of a part

RNDinov8r
Collaborator
Collaborator

So, I have been able to create a method, using the metadata that iPropWiz spits out, to determine the raw stock size of all the material of the custom parts on our machines. iPropWiz spits out the extents box of each and every part created. The intent is to use the qty and size info to generate a list to send to our material vendors. All of that to say, how do I determine if a part is round? I know that if a part has two identical dimensions, it could be round, say x&y or x&z are 20  and 20 mm each, it coudl be round. I flag those parts and the job will verify if the part is truly made from round stock. 

 

What I havent' been able to easily determine is what aobut a shaft that is a "D" shaft, (some flat all along the length, such that it's made from say Ø20mm material, with 1mm removed from one side ). Or a shaft that has a continuous keyway...

 

If these were short peices and only one or two each req'd this wouldn't be a big deal, but if I have to make say, 5 D shafts at 24" long from 316 SS (Ø25mm) and I order square stock instead, that's an expensive mistake.

 

All that to say, is there an easy (or not easy) way to maybe have an iLogic code run "on save" that writes to an iProperty that actually says the part is round.

 

At this point, I am just lookign for methods, not necessarily even code.

 

I had thought of creating a template that HAS to be used for round parts, such that it's iProprty of, say, "Round Stock" was always set to yes, while parts made from the normal template would be set to "no". However, now I have to rely on 6-7 engineers always remember to use the correct template for "round" parts...

0 Likes
Accepted solutions (3)
1,070 Views
14 Replies
Replies (14)
Message 2 of 15

Stakin
Collaborator
Collaborator
Accepted solution

1  add a rule in your template with below snippets

2  specify it to run on "Save"  event

Dim StockType_Eum As String = MessageBox.Show("Is this part a round Part?", "Round Stock Info",MessageBoxButtons.YesNo)
If StockType_Eum = vbYes Then
	iProperties.Value("Custom", "Round Stock") ="True"
Else
	iProperties.Value("Custom", "Round Stock") ="False"
End If
0 Likes
Message 3 of 15

Ralf_Krieg
Advisor
Advisor
Accepted solution

Hello

 

This would mean you see on every save of every part this Messagebox. Really?

If you think of using this way, add minimum a check like

If ThisDoc.Document.FullDocumentname ="" Then
    'your messagebox
End If

 FullDocumentName is empty only before first save. Another option could be to check if property not exist prior the Messagebox.

 

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 4 of 15

nmunro
Collaborator
Collaborator

That is a big ask for automation but relatively easy for humans to decide. You could leverage a list based custom property in your iPropWiz configuration that has all the possible types you might want to use. Making the property required would ensure that users fill in this information. Ping me if you would like to discuss it further.

 

Neil

 

        


https://c3mcad.com

0 Likes
Message 5 of 15

RNDinov8r
Collaborator
Collaborator

@Ralf_Krieg  & @Stakin : So, After I posted this, I was talking to another engineer internally about this, and ultimately this solution came up organically in our discussion. Fire off a message box on save that will prompt the engineer to verify the "form factor". And with that second bit of code, it looks like it would basically fire once per part...once the result is set, it won't ask again. The nice thing about this, is I can use this on "legacy" parts, so if I use a part created 2 or even 6 years ago, I can still handle it. WE are going to be releasing a pretty massive job in about a month, so the intent is to have this ready for that release. Saving my machine shop 2-4 days of raw material sizing/procurement is a huge time saver.

 

@nmunro Neil, that's a good point. That would allow me to differentiate between "Round Stock", "Normal", and "Sheetmetal". Between form factors and our part numbering system, I can sort exactly what the machine shop needs.

0 Likes
Message 6 of 15

RNDinov8r
Collaborator
Collaborator

So, I am in the process of implementing this. So far,  the two codes above are working fine, for parts where my custom iProperty "Form Factor" exists...however, when I open a file without that iProperty, i get an error. Is there quick code that checks the part and says if, iProperties.Value("Custom", "Form Factor") then create it? I only use this in .ipt files, no .iams, .idws, or .ipns

0 Likes
Message 7 of 15

Ralf_Krieg
Advisor
Advisor
Accepted solution

Hello

 

A basic test and create

Dim iProp As Inventor.Property
For Each iProp In ThisDoc.Document.PropertySets("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")
	If iProp.Name = "Form Factor" Then Exit For
Next

If iProp Is Nothing Then
	iProperties.Value("Custom", "Form Factor") = "YOUR_INITIAL_VALUE"
End If

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 8 of 15

RNDinov8r
Collaborator
Collaborator

So here's what I have...I trigger on New and Open.

Dim iProp As Inventor.Property
For Each iProp In ThisDoc.Document.PropertySets("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")
	If iProp.Name = "Form Factor" Then Exit For
Next

If iProp Is Nothing Then
	iProperties.Value("Custom", "Form Factor") = ""
End If

If iProperties.Value("Custom", "Form Factor") = "" Then
	Dim FormFactor As String = MessageBox.Show("Is this part a round Part?", "Round Stock Info", MessageBoxButtons.YesNo)
	If FormFactor = vbYes Then
		iProperties.Value("Custom", "Form Factor") ="ROUND"
	Else
		iProperties.Value("Custom", "Form Factor") ="SQUARE"
	End If
End If

So, from what I can tell, it's not creating the iProperty "fast enough" or there needs to be an updated before I run the second part of the code. The second part works well (tested), when parts do have the iProperty present.

0 Likes
Message 9 of 15

Ralf_Krieg
Advisor
Advisor

Hello

 

I've tested it on open document trigger and it works as expected. Can you please try it with this alternative way of adding new iProp?

I assume there's no other rule running? Did you see an error message or does still nothing happen? Are you opening parts separat or are they placed/created in an assembly?

Dim iProp As Inventor.Property
For Each iProp In ThisDoc.Document.PropertySets("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")
	If iProp.Name = "Form Factor" Then Exit For
Next

If iProp Is Nothing Then
	'iProperties.Value("Custom", "Form Factor") = ""
	ThisDoc.Document.PropertySets("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}").Add("","Form Factor")
End If

If iProperties.Value("Custom", "Form Factor") = "" Then
	Dim FormFactor As String = MessageBox.Show("Is this part a round Part?", "Round Stock Info", MessageBoxButtons.YesNo)
	If FormFactor = vbYes Then
		iProperties.Value("Custom", "Form Factor") ="ROUND"
	Else
		iProperties.Value("Custom", "Form Factor") ="SQUARE"
	End If
End If

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 10 of 15

_dscholtes_
Advocate
Advocate

@RNDinov8r wrote:

how do I determine if a part is round? I know that if a part has two identical dimensions, it could be round, say x&y or x&z are 20  and 20 mm each, it coudl be round.


As already mentioned, the easiest way is letting the user / creator of the part tell you it's a shaft by setting a custom property (our PLM system checks our parts / assemblies for the presence of certain properties before including them in its library).

But when your code finds a cylindrical surface in the part, having the same diameter as the two identical dimensions, then the part is most probably (created from) a shaft. Mind that the cylindrical surface doesn't need to be fully closed (360°), so the flat section along the axis is no problem. And as soon as you have written the code that determines a shaft like this, someone will hand you a shaft for which the code doesn't work or a bar that passes it 😛 And then some fine tuning is required.

0 Likes
Message 11 of 15

RNDinov8r
Collaborator
Collaborator

This is my error upon running with a trigger "on open". And, I am just opening a part...not an assembly with parts missing the iProperty.

RNDinov8r_0-1618920482190.pngRNDinov8r_1-1618920495799.png

And, if I run it after it opens...I still have the same issue...

WE don't use vault, so I know it's not a checked out part.

I even have "All Events Trigger" selected in my iLogic Security.

I have one rule running "after Save" that converts parts to STEP files, but since its not the same event, I can't see that would be an issue.

 

0 Likes
Message 12 of 15

RNDinov8r
Collaborator
Collaborator

I even threw a pause in there..thinking it was running into the next instruction before the iProperty could be created....and even at 1 second (a billion years in computer time), I still get the same error. 

Dim iProp As Inventor.Property
For Each iProp In ThisDoc.Document.PropertySets("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")
	If iProp.Name = "Form Factor" Then Exit For
Next

If iProp Is Nothing Then
	'iProperties.Value("Custom", "Form Factor") = ""
	ThisDoc.Document.PropertySets("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}").Add("","Form Factor")
End If

System.Threading.Thread.CurrentThread.Sleep(1000)

If iProperties.Value("Custom", "Form Factor") = "" Then
	Dim FormFactor As String = MessageBox.Show("Is this part a round Part?", "Round Stock Info", MessageBoxButtons.YesNo)
	If FormFactor = vbYes Then
		iProperties.Value("Custom", "Form Factor") ="ROUND"
	Else
		iProperties.Value("Custom", "Form Factor") ="SQUARE"
	End If
End If
0 Likes
Message 13 of 15

lmc.engineering
Advocate
Advocate

Hi @RNDinov8r 

 

Looks to me that you just need to change your logic here. We can just assume if it's not found the iProperty then we go straight to creating it. No need to add it as a blank and test for it's value in the same routine; that's likely your issue why it doesn't work; You need to update the document between creating the iProperty and testing for it's value.

 

The below should work better for you.

 

Dim ValueList As New List(Of String)({"Round", "Square", "Other" }) ' Add more options here if needed
Dim iPropVal As String

Try
	'See if the iProperty exists currently
	iPropVal = iProperties.Value("Custom", "Form Factor")
Catch ex As Exception
	'It doesn't exists, so create it
	iPropVal = InputListBox("Prompt", ValueList, ValueList.Item(0), Title := "iLogic", ListName := "Form List")
	If iPropVal Is Nothing Then Return ' User closed form before selecting option
	iProperties.Value("Custom", "Form Factor") = iPropVal
End Try

 

0 Likes
Message 14 of 15

RNDinov8r
Collaborator
Collaborator

So, that was it... I needed it to fire on a new file creation, and had to prompt for input there as well, so I add thed last four lines...but this is what I needed. Thanks Guys!!!!

 

Dim ValueList As New List(Of String)({"ROUND", "SQUARE", "SHEET", "PURCHASED" }) ' Add more options here if needed
Dim iPropVal As String

Try
	'See if the iProperty exists currently
	iPropVal = iProperties.Value("Custom", "Form Factor")
Catch ex As Exception
	'It doesn't exists, so create it
	iPropVal = InputListBox("Prompt", ValueList, ValueList.Item(0), Title := "iLogic", ListName := "Form List")
	If iPropVal Is Nothing Then Return ' User closed form before selecting option
	iProperties.Value("Custom", "Form Factor") = iPropVal
End Try

If iProperties.Value("Custom", "Form Factor") = Nothing Then
	iPropVal = InputListBox("Prompt", ValueList, ValueList.Item(0), Title := "iLogic", ListName := "Form List")
	If iPropVal Is Nothing Then Return ' User closed form before selecting option
End If
Message 15 of 15

lmc.engineering
Advocate
Advocate

Sorry, I realise now you want to lock the user in to answering without the option to back out by closing the form. I've added a rough and ready way to ensure an answer is selected instead of you having the additional four lines.. 

 

Dim ValueList As New List(Of String)({"ROUND", "SQUARE", "SHEET", "PURCHASED" }) ' Add more options here if needed
Dim iPropVal As String

Try
	'See if the iProperty exists currently
	iPropVal = iProperties.Value("Custom", "Form Factor")
Catch ex As Exception
	'It doesn't exists, so create it
	Line1:
	iPropVal = InputListBox("Prompt", ValueList, ValueList.Item(0), Title := "iLogic", ListName := "Form List")
	If iPropVal Is Nothing Then  ' User closed form before selecting option
		MessageBox.Show("Please select a value", "Form List")
		GoTo line1
	End If
	iProperties.Value("Custom", "Form Factor") = iPropVal
End Try

 

0 Likes