How can I mark canvas and change their color by selecting from the list

How can I mark canvas and change their color by selecting from the list

maciej0202g
Contributor Contributor
1,573 Views
21 Replies
Message 1 of 22

How can I mark canvas and change their color by selecting from the list

maciej0202g
Contributor
Contributor

Hello everyone, can anyone 2021-12-09 15_36_58-Autodesk Inventor 2015 - [Część_1].pngtell me how to write code in ilogic that will mark each plane with a color

0 Likes
1,574 Views
21 Replies
Replies (21)
Message 2 of 22

WCrihfield
Mentor
Mentor
Accepted solution

Hi @maciej0202g.  If you want to use an iLogic Form in your process, and you want to have a list of part faces on your form, with a drop-down list of available colors/appearances beside them, you will need to assign names to each of those faces first.  Then your code will need to create a new multi-value text type user parameter for each named face, and put the list of colors/appearances into that parameter as its possible values.  Then you can show those multi-value parameters in your Form, similar to the image you posted.  Then you will likely need a different code to react to the changes you make in the Form, and will change the color/appearance of the named face to the color/appearance named in its associated parameter.  It would include need to include some prep work and a time to set-up and create all of that.  Are you sure you want to dive into all of that?  If so, do you have a sample part you could post here for us to work on and set-up that way for you?  If you post a part, make sure it doesn't contain any personal or proprietary info/data.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 22

maciej0202g
Contributor
Contributor
Accepted solution

When we put some colors on the planes of point A, from point B, where inventor writes information about the color on a given plane. I need to extract this information to manage components.

 

screen_1a.pngscreen_2.png

 

 

 

 

0 Likes
Message 4 of 22

WCrihfield
Mentor
Mentor

What version of Inventor are you using?  I am using Inventor 2022.1.1.  If you are using Inventor 2021 or earlier, you will most likely not be able to open or use the model I am sending back to you (attached).  Also, I have downloaded your new model this morning, and everything looks OK to me.  I assigned names to the faces, just like in your provided image, then created an iLogic rule that was to update the appearances of those faces based on the changes you make in the iLogic Form.  However, it is not working yet for one main reason.  The values of those 4 parameters do not seem to match the names of any existing appearances in either the document or in the active appearance library (on my end).  I was expecting those parameter values to be the exact names of existing appearances in the document.  I believe if that little bit is updated, it will work.  Or, it might be possible that you are using a custom appearances library that does contain those appearance names, and I just can see it on my computer.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 22

maciej0202g
Contributor
Contributor
Accepted solution

Inventor 2015

 

screen_3.png

 

And paste the ilogik code from the file part_2 here, I will try to put it in my version of inventora

0 Likes
Message 6 of 22

WCrihfield
Mentor
Mentor

OK.  So I won't be able to work on a model for you then send you the model file.  We will have to coach you through how to set it up for yourself.  The first step you need to do is assign names to those faces.  And it will be a more difficult process for you to assign names to geometry, because the user interface tool that process that exists in later versions, did not exist yet in Inventor 2015, but I believe the functionality behind that process did exist in that version.  That process alone will require you to use either an iLogic rule or VBA macro that will help you assign those names to those faces.  I do have some resources you can use for that task.

 

Here is an iLogic rule you can use for that process.  You may need to translate the messages within it to your language.  When you run this rule, it will want you to select a part face.  Then it will make sure something was selected (if nothing selected, exits).  Then makes sure that a Face was selected (not some other type of object).  Then checks that Face for the needed AttributeSet and Attribute for assigning a name to it.  The whole main process of the code is within a Do...Loop statement, so it will keep working until nothing is selected.

 

If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kPartDocumentObject Then
	MsgBox("A Part Document must be active for this rule to work. Exiting.",vbCritical, "WRONG DOCUMENT TYPE")
	Exit Sub
End If

Do 'start a loop of selecting and assigning names
	'select a face to assign a name to
	SelectFace :
	oObj = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Select A Face To Assign A Name To")
	'make sure something was selected.
	If oObj Is Nothing Then Exit Do 'or Exit Sub, or Return
	If Not TypeOf oObj Is Face Then
		MsgBox("The object you selected was not a part face.  Please select a part face.", vbInformation, "iLogic")
		GoTo SelectFace
	End If
	Dim oFace As Face = oObj

	oFaceName = InputBox("Enter Name For Selected Face.", "Face Name", "")
	If String.IsNullOrEmpty(oFaceName) Then Exit Do 'or Exit Sub, or Return

	'now make sure the needed attribute set & attribute are attached to it
	'if not create them as needed
	oAttributeSetName = "iLogicEntityNameSet"
	Dim oAttributeSet As AttributeSet
	oSets = oFace.AttributeSets
	If oSets.NameIsUsed(oAttributeSetName) Then
		oAttributeSet = oSets.Item(oAttributeSetName)
	Else
		oAttributeSet = oSets.Add(oAttributeSetName)
	End If

	oAttributeName = "iLogicEntityName"
	Dim oAttribute As Attribute
	If oAttributeSet.NameIsUsed(oAttributeName) Then
		oAttribute = oAttributeSet.Item(oAttributeName)
		If oAttribute.Value <> oFaceName Then
			oAns = MsgBox("That face already has a different name assigned to it." & vbCrLf & _
			"Do you want to change its name [Yes] or leave it alone [No]?", vbYesNo + vbQuestion, "Face Has Other Name")
			If oAns = vbYes Then
				oAttribute.Value = oFaceName
			End If
		End If
	Else
		oAttribute = oAttributeSet.Add(oAttributeName, ValueTypeEnum.kStringType, oFaceName)
	End If
Loop Until oObj Is Nothing

PS.  The attribute set name and attribute name are critical (understood by Inventor for this process) so don't change them.

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 7 of 22

WCrihfield
Mentor
Mentor

The code I had written for updating the appearances of the named faces, I am going to have to do some more work on, because I realized it was using some code that will not work for you in Inventor 2015.  I will have to generate more and different code within that rule to accomplish what I had before.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 8 of 22

WCrihfield
Mentor
Mentor

I believe I have something for you for the iLogic rule to update the named faces.  I tried to include a lot of lines of comments within the rule code to help guide you through what is going on, but it may still seem a bit advanced or difficult to understand.  You may have to translate those comment lines though.

Here is the code:

Sub Main
	Dim oPart As PartDocument = ThisDoc.Document
	oPDef = oPart.ComponentDefinition
	
	'this next line runs our custom Function below
	'and returns / assigns a Dictionary to our variable
	'it is a collection and will contain name / value pairs as its items
	'name = Key = the name assigned to the object
	'Value =  the object that the name was assigned to
	oNamedEntities = GetNamedEntities(oPart)
	
	Dim oFace_1, oFace_2, oFace_3, oFace_4 As Face
	For Each oEntry In oNamedEntities
		If oEntry.Key = "Face_1" Then
			oFace_1 = oEntry.Value
		ElseIf oEntry.Key = "Face_2" Then
			oFace_2 = oEntry.Value
		ElseIf oEntry.Key = "Face_3" Then
			oFace_3 = oEntry.Value
		ElseIf oEntry.Key = "Face_4" Then
			oFace_4 = oEntry.Value
		End If
	Next

	'now that we have searched for the named entities, we can move on to trying to set their appearances
	'we still don't know if those variables hold values, so we need to check them before using them, to avoid errors
	If oFace_1 IsNot Nothing Then
		'try to find & get the 'appearance asset' with the same name as is in the Face_1 parameter's Value
		Dim oAAsset1 As Asset
		Try
			oAAsset1 = oPart.AppearanceAssets.Item(Face_1)
		Catch
			oAAsset1 = ThisApplication.ActiveAppearanceLibrary.AppearanceAssets.Item(Face_1)
		Catch
			MsgBox("Could not find an 'appearance' named '" & Face_1 & "' in this document, or the active appearances library.", vbCritical, "iLogic")
		End Try
		'now assign that appearance type asset as the appearance of our face
		If oAAsset1 IsNot Nothing Then
			oFace_1.Appearance = oAAsset1
		End If
	Else
		MsgBox("A Face named 'Face_1' was not found.", vbExclamation, "Face Not Found")
	End If

	If oFace_2 IsNot Nothing Then
		Dim oAAsset2 As Asset
		Try
			oAAsset2 = oPart.AppearanceAssets.Item(Face_2)
		Catch
			oAAsset2 = ThisApplication.ActiveAppearanceLibrary.AppearanceAssets.Item(Face_2)
		Catch
			MsgBox("Could not find an 'appearance' named '" & Face_2 & "' in this document, or the active appearances library.", vbCritical, "iLogic")
		End Try
		If oAAsset2 IsNot Nothing Then
			oFace_2.Appearance = oAAsset2
		End If
	Else
		MsgBox("A Face named 'Face_2' was not found.", vbExclamation, "Face Not Found")
	End If

	If oFace_3 IsNot Nothing Then
		Dim oAAsset3 As Asset
		Try
			oAAsset3 = oPart.AppearanceAssets.Item(Face_3)
		Catch
			oAAsset3 = ThisApplication.ActiveAppearanceLibrary.AppearanceAssets.Item(Face_3)
		Catch
			MsgBox("Could not find an 'appearance' named '" & Face_3 & "' in this document, or the active appearances library.", vbCritical, "iLogic")
		End Try
		If oAAsset3 IsNot Nothing Then
			oFace_3.Appearance = oAAsset3
		End If
	Else
		MsgBox("A Face named 'Face_3' was not found.", vbExclamation, "Face Not Found")
	End If

	If oFace_4 IsNot Nothing Then
		Dim oAAsset4 As Asset
		Try
			oAAsset4 = oPart.AppearanceAssets.Item(Face_4)
		Catch
			oAAsset4 = ThisApplication.ActiveAppearanceLibrary.AppearanceAssets.Item(Face_4)
		Catch
			MsgBox("Could not find an 'appearance' named '" & Face_4 & "' in this document, or the active appearances library.", vbCritical, "iLogic")
		End Try
		If oAAsset4 IsNot Nothing Then
			oFace_4.Appearance = oAAsset4
		End If
	Else
		MsgBox("A Face named 'Face_4' was not found.", vbExclamation, "Face Not Found")
	End If
End Sub

Function GetNamedEntities(oPartDocument As PartDocument) As Dictionary(Of String, Object)
	'retrieve all named geometry in this document into one variable
	'in Inventor 2019.1 and later the following line would have worked for this task
	'oNEs = iLogicVb.Automation.GetNamedEntities(oDocument)

	'in earlier versions, we had to use this process
	'create a variable that can store multiple name & value sets
	'name = Key = name assigned to entity
	'Value = the object that the name was assigned to
	Dim oNamedEntities As New Dictionary(Of String, Object)
	'find all attribute sets that are named properly (attribute set name is critical)
	oSets = oPartDocument.AttributeManager.FindAttributeSets("iLogicEntityNameSet", "iLogicEntityName")
	If oSets.Count = 0 Then
		'MsgBox("No Named geometry was found.  Exiting.", vbCritical, "iLogic")
		'return an empty Dictionary, then exit this function
		'you will have to check the 'Count' of the returned Dictionary to see if it contains anything
		Return oNamedEntities
	End If
	'we now know it found some attribute sets, so loop through them
	For Each oSet As AttributeSet In oSets
		'check if it contains the proper attribute (attribute name is critical)
		If oSet.NameIsUsed("iLogicEntityName") Then
			'found one, so get the 'assigned name' from its Value
			Dim oEntityName As String = oSet.Item("iLogicEntityName").Value
			'oSet.Parent will be the Object that the name was assigned to
			oNamedEntities.Add(oEntityName, oSet.Parent)
		End If
	Next
	Return oNamedEntities
End Function

 

But remember...the values within those parameters must match the names of appearances that exist in the document, or the code won't work.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 9 of 22

maciej0202g
Contributor
Contributor

Should I use both or only the latter? Admits that it is not easy. When I pasted both codes, a few errors pop up

screen_6.png

 

Error in rule: Rule2, document: Part_2.ipt

A COM object of type 'System .__ ComObject' cannot be cast to interface type 'Inventor.Face'. This operation failed because calling the QueryInterface method for a COM component to obtain the IID interface '{5DF8608B-6B16-11D3-B794-0060B0F159EF}' failed with the following error: This interface is not supported. (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

0 Likes
Message 10 of 22

WCrihfield
Mentor
Mentor

Each code I posted should be separate rules.  The first rule was a rule to use in preparation, one time, just to assign the names to the faces, so they can be found by the other rule later.  The second rule is to react to when you change the values of those parameters, then it will try to find those named faces and try to change their appearance to the appearance named in the parameter for that face.  It is supposed to run every time any of those 4 parameter values changes.  If you have the two codes in separate rules already, but the one rule is throwing that error when you run it, then I will have to investigate that error.  It appears to be having trouble recognizing an object as an Inventor.Face, which might be possible.  The 'Pick' method returns an Object (a generic Type), and the Value part of the Dictionary object's items is defined here as an Object, instead of a Face (to allow Edges & Vertex type objects to be used later, if wanted), so we may need to put some extra code in there to 'filter' what Type of object is actually being returned, before proceeding.  I'm certainly not perfect at this, so I may have not accounted for every possible potential error.

 

Also, the other rule you have, for updating the iProperty values from the Parameter values.  I did s little bit of work on that too, that I believe may help.  Basically, when you are using 'local' rules (saved within a document), and you want that rule to be triggered to run automatically every time one of the 'local' parameters being used within that rule is changed, then you can use the unquoted names of those parameters within that rule to cause that behavior to happen.  So that rule could be changed like this:

 

 iProperties.Value("Custom", "Face_1") = Face_1
 iProperties.Value("Custom", "Face_2") = Face_2
 iProperties.Value("Custom", "Face_3") = Face_3
 iProperties.Value("Custom", "Face_4") = Face_4

 

Since your parameters are named "Face_1", and so on, when you put that into a rule that is saved in the same document as that parameter, unquoted, it will turn blue, by default (color can be changed, different), which tells you that it is recognized as a local parameter.  Whenever the value of that parameter changes, it will cause that rule to be ran.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 11 of 22

maciej0202g
Contributor
Contributor
Accepted solution

Thank you very much for your help, I can't do it today. Tomorrow I will work with this problem.

0 Likes
Message 12 of 22

maciej0202g
Contributor
Contributor
Accepted solution

Good morning

I made a short video using the code you wrote

https://we.tl/t-G0OX6IBMoh

 

Error in rule: Code_2, document: Part_2.ipt

A COM object of type 'System .__ ComObject' cannot be cast to interface type 'Inventor.Face'. This operation failed because calling the QueryInterface method for a COM component to obtain the IID interface '{5DF8608B-6B16-11D3-B794-0060B0F159EF}' failed with the following error: This interface is not supported. (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

0 Likes
Message 13 of 22

WCrihfield
Mentor
Mentor

Hi @maciej0202g.  That one code appears to be having trouble with object Type differences relating to the generic Objects and the Face objects.  So, I altered the code in that rule a bit to add more checks and object type specificity.  I changed the Type of the second item in the Dictionary fro Object to Inventor.Face, and made sure that only a Face type object can be added to it, so that only Face type objects can be retrieved from it.  This takes away from the dynamic usefulness of that part of the code, but adds more stability for this specific process, since you only intent to assign names to Faces, and not to any Edges or Vertices.

Here is the updated code for "Code_2" rule:

Sub Main
	Dim oPart As PartDocument = ThisDoc.Document
	oPDef = oPart.ComponentDefinition
	
	'this next line runs our custom Function below
	'and returns / assigns a Dictionary to our variable
	'it is a collection and will contain name / value pairs as its items
	'name = Key = the name assigned to the object
	'Value =  the object that the name was assigned to
	Dim oNamedEntities As Dictionary(Of String, Inventor.Face) = GetNamedEntities(oPart)
	If oNamedEntities.Count = 0 Then
		MsgBox("No Named Faces were found.  Exiting rule.", vbCritical, "")
		Exit Sub
	End If
	Dim oFace_1, oFace_2, oFace_3, oFace_4 As Face
	For Each oEntry In oNamedEntities
		If oEntry.Key = "Face_1" Then
			oFace_1 = oEntry.Value
		ElseIf oEntry.Key = "Face_2" Then
			oFace_2 = oEntry.Value
		ElseIf oEntry.Key = "Face_3" Then
			oFace_3 = oEntry.Value
		ElseIf oEntry.Key = "Face_4" Then
			oFace_4 = oEntry.Value
		End If
	Next

	'now that we have searched for the named entities, we can move on to trying to set their appearances
	'we still don't know if those variables hold values, so we need to check them before using them, to avoid errors
	If oFace_1 IsNot Nothing Then
		'try to find & get the 'appearance asset' with the same name as is in the Face_1 parameter's Value
		Dim oAAsset1 As Asset
		Try
			oAAsset1 = oPart.AppearanceAssets.Item(Face_1)
		Catch
			oAAsset1 = ThisApplication.ActiveAppearanceLibrary.AppearanceAssets.Item(Face_1)
		Catch
			MsgBox("Could not find an 'appearance' named '" & Face_1 & "' in this document, or the active appearances library.", vbCritical, "iLogic")
		End Try
		'now assign that appearance type asset as the appearance of our face
		If oAAsset1 IsNot Nothing Then
			oFace_1.Appearance = oAAsset1
		End If
	Else
		MsgBox("A Face named 'Face_1' was not found.", vbExclamation, "Face Not Found")
	End If

	If oFace_2 IsNot Nothing Then
		Dim oAAsset2 As Asset
		Try
			oAAsset2 = oPart.AppearanceAssets.Item(Face_2)
		Catch
			oAAsset2 = ThisApplication.ActiveAppearanceLibrary.AppearanceAssets.Item(Face_2)
		Catch
			MsgBox("Could not find an 'appearance' named '" & Face_2 & "' in this document, or the active appearances library.", vbCritical, "iLogic")
		End Try
		If oAAsset2 IsNot Nothing Then
			oFace_2.Appearance = oAAsset2
		End If
	Else
		MsgBox("A Face named 'Face_2' was not found.", vbExclamation, "Face Not Found")
	End If

	If oFace_3 IsNot Nothing Then
		Dim oAAsset3 As Asset
		Try
			oAAsset3 = oPart.AppearanceAssets.Item(Face_3)
		Catch
			oAAsset3 = ThisApplication.ActiveAppearanceLibrary.AppearanceAssets.Item(Face_3)
		Catch
			MsgBox("Could not find an 'appearance' named '" & Face_3 & "' in this document, or the active appearances library.", vbCritical, "iLogic")
		End Try
		If oAAsset3 IsNot Nothing Then
			oFace_3.Appearance = oAAsset3
		End If
	Else
		MsgBox("A Face named 'Face_3' was not found.", vbExclamation, "Face Not Found")
	End If

	If oFace_4 IsNot Nothing Then
		Dim oAAsset4 As Asset
		Try
			oAAsset4 = oPart.AppearanceAssets.Item(Face_4)
		Catch
			oAAsset4 = ThisApplication.ActiveAppearanceLibrary.AppearanceAssets.Item(Face_4)
		Catch
			MsgBox("Could not find an 'appearance' named '" & Face_4 & "' in this document, or the active appearances library.", vbCritical, "iLogic")
		End Try
		If oAAsset4 IsNot Nothing Then
			oFace_4.Appearance = oAAsset4
		End If
	Else
		MsgBox("A Face named 'Face_4' was not found.", vbExclamation, "Face Not Found")
	End If
End Sub

Function GetNamedEntities(oPartDocument As PartDocument) As Dictionary(Of String, Inventor.Face)
	'retrieve all named geometry in this document into one variable
	'in Inventor 2019.1 and later the following line would have worked for this task
	'oNEs = iLogicVb.Automation.GetNamedEntities(oDocument)

	'in earlier versions, we had to use this process
	'create a variable that can store multiple name & value sets
	'name = Key = name assigned to entity
	'Value = the object that the name was assigned to
	Dim oNamedEntities As New Dictionary(Of String, Inventor.Face)
	'find all attribute sets that are named properly (attribute set name is critical)
	oSets = oPartDocument.AttributeManager.FindAttributeSets("iLogicEntityNameSet", "iLogicEntityName")
	If oSets.Count = 0 Then
		'MsgBox("No Named geometry was found.  Exiting.", vbCritical, "iLogic")
		'return an empty Dictionary, then exit this function
		'you will have to check the 'Count' of the returned Dictionary to see if it contains anything
		Return oNamedEntities
	End If
	'we now know it found some attribute sets, so loop through them
	For Each oSet As AttributeSet In oSets
		'check if it contains the proper attribute (attribute name is critical)
		If oSet.NameIsUsed("iLogicEntityName") Then
			'found one, so get the 'assigned name' from its Value
			Dim oEntityName As String = oSet.Item("iLogicEntityName").Value
			'oSet.Parent will be the Object that the name was assigned to
			'since we are only looking for 'Face' objects, not Edge, or Vertex,
			'we must make sure this object is a Face before adding it to our Dictionary
			If TypeOf oSet.Parent Is Face Then
				'create a Face type variable then set this object as its value
				Dim oNamedFace As Face = oSet.Parent
				'now add that Face type variable, referencing that Face to the Dictionary
				oNamedEntities.Add(oEntityName, oNamedFace)
			End If
		End If
	Next
	Return oNamedEntities
End Function

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 14 of 22

maciej0202g
Contributor
Contributor

Now, after describing each tearful Face_1, Face_2, Face_3, Face_4 and pressing the espace key, a message pops up

No Named Faces were found, Exiting rule.

0 Likes
Message 15 of 22

WCrihfield
Mentor
Mentor

Hmm...

Try changing or replacing this block of code (down within the GetNamedEntities function):

If TypeOf oSet.Parent Is Face Then
	'create a Face type variable then set this object as its value
	Dim oNamedFace As Face = oSet.Parent
	'now add that Face type variable, referencing that Face to the Dictionary
	oNamedEntities.Add(oEntityName, oNamedFace)
End If

with this block of code:

If TypeOf oSet.Parent Is AttributeSets And _
	TypeOf oSet.Parent.Parent Is Face Then
	'create a Face type variable then set this object as its value
	Dim oNamedFace As Face = oSet.Parent.Parent
	'now add that Face type variable, referencing that Face to the Dictionary
	oNamedEntities.Add(oEntityName, oNamedFace)
End If

 I believe I missed a step, because the 'Parent' of an AttributeSet is the AttributeSets object, not the face itself yet.  The Face would be the 'Parent' of the AttributeSets object, which is another step up the ladder.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 16 of 22

maciej0202g
Contributor
Contributor

s1.png

Error in rule: Code_2, document: Part_2_13-12-2021.ipt

The parameter is invalid. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

 

s2.png

0 Likes
Message 17 of 22

WCrihfield
Mentor
Mentor

OK.  Now it is throwing an error at a line of code where it is attempting to set a new value for the Face Appearance (Face.Appearance).  The value we supply as the new appearance there must be an Asset object, which represents the appearance we want to assign to the face.  In order to get the right Asset to use, we must first find it.  In this code we are trying to find the appearance, by its name.  The name we are using to find the appearance asset is the value of the parameter.  If the parameter's value is not exactly the same as the name of an appearance asset within either the local document or the active appearances library, then that appearance asset will never be found, and the code will never work.  However, if it is successfully finding the appearance asset, but then throwing an error when it tries to set that as the value of the Face.Appearance, then I'm not sure why that would happen or how to fix it.  The documentation does not explain any possible reasons for that specific action to fail.

 

Are you able to manually (without code) select one of those faces, then while it is still selected choose another appearance from the appearance library menu, then the appearance of that selected face changes to that new color?  If that works, then I'm not sure why our code would be encountering an error while trying to change the appearance of the face, as long as the appearance is found and available.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 18 of 22

maciej0202g
Contributor
Contributor
Accepted solution

Mr. WCrihfield, however, the code you created works :), tomorrow I will try to record the screen with the presentation of this, thank you very much 🙂

0 Likes
Message 19 of 22

maciej0202g
Contributor
Contributor
Accepted solution

I'm sending a short video of how the WCrihfield code works, it works

 https://we.tl/t-Tp8kT0SnjY

 

 

Mr. WCrihfield, would it take a long time to add to this panel?
A - possibility to choose a material from a drop-down list
B - material density display
C - material weight display

 

screen1.png

 

0 Likes
Message 20 of 22

WCrihfield
Mentor
Mentor

I watched your video.  Good to see all appears to be working now.

It looks like you already have the material drop-down list in your form, so I am not sure why you say you still need to add it.  The material density and material weight could be fairly easily added to the form, because there are already existing standard iProperties for those two items.  Both are in the third iProperty set ("Design Tracking Properties").  The one is simply called "Density" (property # 42, PropID 61), while the other is simply called "Mass" (property # 39, PropID 58).  In your Form Editor dialog, in the upper left area, choose the "iProperties" tab, then you can see what iProperties are available to drag and drop into the form creation area.  Unfortunately these two do not appear to be exposed there right now.  So, you may have to create two new custom iProperties, then copy the regular iProperty's values over into those new 'custom' iProperties.  Then you will see those two custom iProperties listed in that area of your form editor dialog, so you can use them in your form.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes