Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Maxim-CADman77
295 Views, 3 Replies

Inconsistency of Construction WorkPlane concept (user can change position of the entity he/she cannot even see)

I believe to have discovered some kind of inconsistency of Construction WorkPlane concept.

 

I love the fact that using API I can create some auxiliary work entities (WorkPlanes) that are not available to end-user in Model Browser.

But I find it a bit strange that user still can modify position of those entities by editing some parameters.

 

For example if create new IPT and run the iLogic code like:

 

Dim oPCD As ComponentDefinition = ThisDoc.Document.ComponentDefinition
oPCD.WorkPlanes.AddByPlaneAndOffset(oPCD.WorkPlanes(1), 0, True)

 

A new Construction (invisible in Model browser) WorkPlane would be added (which is great).

...but then user can modify position of this WorkPlane by editing the value of offset parameter (which seems not reasonable).

 

I'd like to know whether it is possible to hide that offset parameter from user?

Please vote for Inventor-Idea Text Search within Option Names

WCrihfield
in reply to: Maxim-CADman77

Hi @Maxim-CADman77.  This sounds like a good one for the folks at Autodesk directly, since they designed that 'construction' toggle ability.  I assume they may just be getting the BrowserNode for that WorkPlane, then setting its Visible property to False,  so that the node does not show in the browser tree, but that is just speculation on my part.  I wander if you would be able to use the ModelParameter.ConvertToReferenceParameter method, to make that parameter un-editable?  That may cause it to become unconstrained though, so it may move...not sure.  Maybe add the WorkPlane as Fixed instead, or convert it to fixed afterwards.  Just some thoughts.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

I don't know the reason why you need to hide workplane from UI. But if you want to hide some part of model history, you can use ClientFeature functionality. How it works you can see in any profile from ContentCenter (Driven Length feature)

If you want, you can also use HiddenParameters property to hide parameters from the user. See this thread for more info.

 

EDIT:

Code sample

Sub Main
	Dim part As PartDocument = ThisDoc.Document

	Dim cliFeatures As ClientFeatures = part.ComponentDefinition.Features.ClientFeatures

	Dim xyWorkPlane As WorkPlane = part.ComponentDefinition.WorkPlanes(3)
	Dim wPlane As WorkPlane = part.ComponentDefinition.WorkPlanes.AddByPlaneAndOffset(xyWorkPlane, 1)

	Dim cliFeatureDef As ClientFeatureDefinition = cliFeatures.CreateDefinition("HiddenWorkPlane", wPlane)
	Call cliFeatureDef.AddDependency(wPlane.Definition.Offset)

	Dim cliFea As ClientFeature = cliFeatures.Add(cliFeatureDef, "your-client-id-here")

	Dim hiddenParams As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection()
	hiddenParams.Add(cliFea.Parameters(1))
	cliFea.HiddenParameters = hiddenParams
End Sub
WCrihfield
in reply to: Michael.Navara

Using the ClientFeature route seems to do the opposite scenario of the normal WorkPlane set to Construction status.  When creating a WorkPlane, and setting it to Construction, you do not see the WorkPlane in the browser tree or on the screen, but you do see the parameter in the parameters dialog.  But when using the ClientFeature route shown above, you do see the node for it in the model browser, and on the modeling screen, but you don't see the parameter in the parameters dialog box.  Interesting situation.  I suppose you could add this following little bit of code to the end of the ClientFeature code, to take it another step, and at least hide it in the model browser tree, but it would still be visible on the screen.  Maybe if you turn visibility of the WorkPlane off right after you create it, that would solve the problem.

 

cliFea.BrowserNode.Visible = False

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)