Get Name of component in VB when selecting face
Get Name of component in VB when selecting face
(OP)
I'm still doing research on this one but thought I'd ask before reinventing the wheel.
The idea is the user selects two groups of faces which will be checked against each other and data gathered and dumped in an external file for later perusal.
Is it possible when the user selects the first face to not only grab the face for use, but also the name of the component in the assembly, or the name of the part file if it is a work part, to be used as a file name?
So far I've had no luck finding anything to grab the name of the component, but I'm still looking.
Thanks.
The idea is the user selects two groups of faces which will be checked against each other and data gathered and dumped in an external file for later perusal.
Is it possible when the user selects the first face to not only grab the face for use, but also the name of the component in the assembly, or the name of the part file if it is a work part, to be used as a file name?
So far I've had no luck finding anything to grab the name of the component, but I'm still looking.
Thanks.





RE: Get Name of component in VB when selecting face
Dim tempface As Face = "selected face"
Dim tempbody As Body = tempface.GetBody()
Dim tempcomp As Component = tempbody.OwningComponent
Dim temppart as part = CType(s.Parts.FindObject(tempcomp.Name), Part)
Frank Swinkels
RE: Get Name of component in VB when selecting face
##.##.##.##_Description_REV_Date
When using the above command I am only getting the last part of the name. Is there a way to increase the string length so the entire name is saved or at least the first part of the name rather than the last part?
Thanks
RE: Get Name of component in VB when selecting face
I have some code similar to Frank's:
CODE
www.nxjournaling.com
RE: Get Name of component in VB when selecting face
"Filename Lengths: Unless otherwise stated, filename lengths are limited
to UF_CFI_MAX_FILE_NAME_LEN characters which includes
any periods or extensions. This includes directory names
and part file names. Pathnames are limited to
UF_CFI_MAX_PATH_NAME_LEN characters. Valid characters
for a filename depend on the operating system."
On my system
#define UF_CFI_MAX_FILE_NAME_LEN 128
Frank Swinkels
RE: Get Name of component in VB when selecting face
I found a file in the UGOpen folder called uf_cfi.h but I don't see a place to set the variable length.
From what I see when I run my program the length is currently set the 30 characters and I would like to lengthen it if I can.
Thanks.
RE: Get Name of component in VB when selecting face
#define UF_CFI_MAX_FILE_NAME_LEN 128
my code to attempt to change this value in vb is:
UFConstants.UF_CFI_MAX_FILE_NAME_LEN = 128
And receive the error:
Constant cannot be the target of an assignment
I have tried to find an environmental variable but I don't see it there. I have been trying to find a file that contains the information, but I haven't had any luck, though I did find one that references it it does not contain any place to modify it.
Any help is appreciated.