Construction WorkPlane Name property

Construction WorkPlane Name property

vpeuvion
Advocate Advocate
672 Views
6 Replies
Message 1 of 7

Construction WorkPlane Name property

vpeuvion
Advocate
Advocate

Hello everyone,
In an iLogic rule, I use construction WorkPlanes in part.
I can't seem to name these workPlanes. The (Name) property returns an empty string. I did some research and apparently for construction WorkPlanes the handling of some properties like Name is different but I can't find any additional information.
Has anyone come across this problem before? Is it possible to give a name to a construction WorkPlane?
Thank you in advance.

Vincent.

2021-09-07_10-45-35.png

 

0 Likes
673 Views
6 Replies
Replies (6)
Message 2 of 7

ThomasB44
Mentor
Mentor

Salut @vpeuvion 

Oui c'est possible, il faut passer par la collection d'objets de construction, ou bien boucler dessus.

Voici un exemple :

 

Yes it is possible, you have to go through the collection of construction objects, or loop on it.

Here is an example:

Dim oPartDoc As PartDocument
oPartDoc = ThisApplication.ActiveDocument

Dim oCompDef As PartComponentDefinition
oCompDef = oPartDoc.ComponentDefinition

Dim oWorkPlanes As WorkPlanes
oWorkPlanes = oCompDef.WorkPlanes
Dim oWorkPlane As WorkPlane
'oWorkPlane = oWorkPlanes.Item("Plan de construction1")
oWorkPlane = oWorkPlanes.Item(4)
MessageBox.Show(oWorkPlane.Name, "iLogic")
oWorkPlane.Name = "Mon nouveau nom"

 


Thomas
Mechanical Designer / Inventor Professional 2025
Inventor Professional EESignature

0 Likes
Message 3 of 7

ThomasB44
Mentor
Mentor

The Workplane.Construction command is different. It's just graphical. It's kind of peculiar, but in programming, you can draw things that don't exist in modeling. .😅


Thomas
Mechanical Designer / Inventor Professional 2025
Inventor Professional EESignature

0 Likes
Message 4 of 7

vpeuvion
Advocate
Advocate

 

Sub main()
	Dim oPartDoc As PartDocument = ThisApplication.ActiveDocument
	Dim oPartCompDef As PartComponentDefinition = oPartDoc.ComponentDefinition
	
	Dim oFace As Face = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Pick Face.")
	Dim DecalagePlane As WorkPlane = oPartCompDef.WorkPlanes.AddByPlaneAndOffset(oFace, 20, True)

	Dim oWorkPlanes As WorkPlanes
	oWorkPlanes = oPartCompDef.WorkPlanes
	
	oWorkPlanes.Item(oWorkPlanes.Count).Name = "test2"
	MessageBox.Show(oWorkPlanes.Item(oWorkPlanes.Count).Name.ToString)
	
	Dim oWorkPlane As WorkPlane
	For Each oWorkPlane In oWorkPlanes
		If oWorkPlane.Construction = True Then MessageBox.Show(oWorkPlane.Name.ToString)
	Next
End Sub​

 

Hi Thomas,
thanks for the reply, but my problem is still present.
it does not work for a construction Workplane.
The Name property is empty. I may have misunderstood something.
Attached is a code snippet. if I pass the optional construction argument to true I can't name it but if I pass it to False I can name it.
Thank you.
Vincent.



0 Likes
Message 5 of 7

ThomasB44
Mentor
Mentor

Hi,

You're right, and I don't know why the command :

oWorkPlanes.Count

Is returning 3 more work planes. And they are empty, I would like to know why 🤔

 

You can avoid it this way :

	For i = oWorkPlanes.Count To 4 Step -1
		If oWorkPlanes(i).Name <> "" Then
		MessageBox.Show(oWorkPlanes(i).Name)
		End If
	Next

 But it is a work around.


Thomas
Mechanical Designer / Inventor Professional 2025
Inventor Professional EESignature

0 Likes
Message 6 of 7

vpeuvion
Advocate
Advocate
Sub main()
	Dim oPartDoc As PartDocument = ThisApplication.ActiveDocument
	Dim oPartCompDef As PartComponentDefinition = oPartDoc.ComponentDefinition
	
	Dim oFace As Face = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Pick Face.")
	Dim DecalagePlane As WorkPlane = oPartCompDef.WorkPlanes.AddByPlaneAndOffset(oFace, 20, True)

	DecalagePlane.Name = "test2"
	MessageBox.Show(DecalagePlane.Name.ToString)
	
End Sub

Hi

 

empty construction Workplanes are those created each time the rule is executed.
There are two message boxes and are therefore displayed several times.


Attached is the code that I had made at the base.

"MessageBox.Show(DecalagePlane.Name.ToString)" return an empty string.


I think the Name property of a WorkPlane is used to display it in the design tree. It was deemed unnecessary for a construction WorkPlane since it does not appear in this tree like the adaptive, Visible, GetSize and SetSize properties.

I think these five properties are just not accessible for a WorkPlane if WorkPlane.Construction is true.

Vincent.

0 Likes
Message 7 of 7

ThomasB44
Mentor
Mentor

You're right, if I start a new part from scratch, the oWorkPlanes.Count is good again.

Yan can delete them with oWorkPlanes(i).delete

 

The problem is with your command to add the plane, it's not :

Dim DecalagePlane As WorkPlane = oPartCompDef.WorkPlanes.AddByPlaneAndOffset(oFace, 20, True)

But :

Dim DecalagePlane As WorkPlane = oPartCompDef.WorkPlanes.AddByPlaneAndOffset(oFace, 20, False)

 Or nothing in option, default value is false.

 

A construction work plane is hidden from the user and is not displayed graphically or listed in the browser. If work features are created as construction:
  • If there are no consumers of the construction work feature, it is the responsibility of the creator to delete them since they will never get cleaned up and are not visible to users.

 

So it returns an empty string because he has no name in the browser.


Thomas
Mechanical Designer / Inventor Professional 2025
Inventor Professional EESignature

0 Likes