I suspect you may be right that this is a dead end.
I arrived at the idea of using insertpart2 after recording a macro (see below). I've found that the number 65929 in Part.InsertPart2 (third from bottom) is a bitmask referring to the options selected. So it looks like I can update an existing derived part by selecting it, calling insertpart2 with a new bitmask.
However it doesn't seem possible to find out what the bitmask is currently set to, so I can't make sure I am keeping all other settings at current values.
Dim swApp As Object
Dim Part As SldWorks.ModelDoc2
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Set swApp = _
Set Part = swApp.ActiveDoc
boolstatus = Part.Extension.SelectByID2("104201", "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)
Dim myFeature As SldWorks.Feature
Set myFeature = Part.InsertPart2("", 65929)
Another approach may be to go ahead and insert, then "manually" (still by API) copy the custom properties from the source (if that's what you want) or delete them from the inserted part (if that's what you want)
Thanks Josh, that's pretty close to I want to do, and on reflection I have may asked the wrong question here.
- The macro I have developed exports dxf files for profile cutting
- As part of the process I apply various custom properties to the relevant cut list folder so that Bills of Material are correct
- When the transfer custom properties option is checked for derived parts, the custom properties get linked to the parent part
- I can change the properties with the macro, but at the next rebuild the link is reinstated and any changes overwritten
So really I am looking for a way to break the 'Link to Parent' on custom properties. I don't want to edit the parent part, just the details for the particular model that we are exporting a dxf from.
Thanks to all for input so far
This is very interesting, I think this ought to be sent to the API support for team. I guess the property page manager has evolved faster than the API calls. Why aren't you using assemblies?
We're using standard parts quite frequently with weldments - examples would be doubler plates, and gussets etc. The insert part command works quite well for this (as long as you use mates to position things). But as with anything, there are tradeoffs
I've arrived at the same conclusion - the api hasn't kept up with the property page manager, but would love someone to prove me wrong :-)
By the way, some simple testing has confirmed insertpart2 is a complete dead end. Even though the macro recorded like this , it doesn't actually change an existing part (which makes sense really) - it can only insert new parts.
Old post but I have the same problem ...
Does anyone found a solution in new versions ?
DerivedPartFeatureData is the object that controls this, but custom properties aren't yet supported by it.
Here's an example of how to turn on the import of axes:
Dim swApp As SldWorks.SldWorks
Dim swDoc As ModelDoc2
Dim swFeat As Feature
Dim swPart As PartDoc
Dim swFeatData As DerivedPartFeatureData
Set swApp = Application.SldWorks
Set swDoc = swApp.ActiveDoc
Set swPart = swDoc
Set swFeat = swPart.FeatureByName("Part1") 'or whatever your inserted feature is called
Set swFeatData = swFeat.GetDefinition
swFeatData.AccessSelections swDoc, Nothing
swFeatData.ImportAxis = True
swFeat.ModifyDefinition swFeatData, swDoc, Nothing
EDIT: get yourself added to SPR998811 if you want to raise the priority of getting custom property insertion implemented