WhoCanDo Posted December 10, 2019 Share Posted December 10, 2019 Hi, I can't get the following custom search to work to find this IFC record object. Any suggestions please? Quote Link to comment
Antonio Landsberger Posted December 11, 2019 Share Posted December 11, 2019 Hi @WhoCanDo, have you tried writing 'Tekla Bolt.Bolt Name' instead? Quote Link to comment
WhoCanDo Posted December 12, 2019 Author Share Posted December 12, 2019 No luck. 'Tekla Bolt.Bolt Name' didn't work either. The record 'Tekla Bolt' does exist with the field line 'Bolt Name' but this record is not attached to the object. I'm trying to select the Bolt Name from the ifc record. Any other ideas? Quote Link to comment
Pat Stanford Posted December 13, 2019 Share Posted December 13, 2019 Can you attach a sample file with an instance of the Tekla Bolt with the IFC record attached? Or tell me a simple way to create a file with this object type so I can see what is happening? Quote Link to comment
WhoCanDo Posted December 13, 2019 Author Share Posted December 13, 2019 Thanks Pat, I knew you'd enjoy the challenge. The attached drawing (vw2020 because it wouldn't import in vw2019) has one of the components from an imported .ifc drawing from our client. After importing the vary complex drawing, I wanted to move various components to other layers so I could work with them. I found that I couldn't "Custom Selection" "Field Value" "Tekla Bolt" "Bolt Name". This maybe because, even though these categories list in "Custom Selection", if you look at the Object Info, it's actually a sub-catagory of ifcMechanicalFastener, which is ignored by "Custom Selection". What do you think? Untitled1.vwx Quote Link to comment
Antonio Landsberger Posted December 13, 2019 Share Posted December 13, 2019 I believe I have a solution for you. Use SelectObj with the criteria (IFC_ENTITY='IfcMechanicalFastener') to get all IFC entities that even could have the field "Tekla Bolt". Then make a loop to go through all selected objects using IFC_GetPsetProp to check for the value of "Tekla Bolt". Quote Link to comment
WhoCanDo Posted December 13, 2019 Author Share Posted December 13, 2019 Thanks Antonio, I'll have a go using your suggestion, but unfortunately I don't have the time at the moment. Without the time to do this, I resorted to the inbuilt search option that doesn't work for me, even though the list of ifc records are listed. Maybe this is a bug that needs to be reported or maybe I'm using it incorrectly. Regards Quote Link to comment
Pat Stanford Posted December 13, 2019 Share Posted December 13, 2019 First the background. The Vectorworks IFC implementation uses Record Formats to generate IFC PSets which are basically pulled into the IFC record. This effectively give an extremely extensible record format, but also makes it 'interesting' to get at that IFC Data programmatically. In a worksheet you can use the GetIFCProperty function to tell the worksheet what IFC Pset and Field (Property) to return. But there is no way to use an IFC PSet Property as part of a criteria. This should be submitted as a Wish/Enhancement request. Or at the very least be able to tell if a given Pset is part of the IFC record. So the following script will select every object in a drawing that has an IFC Type of "IFCMechanicalFastener" AND has a non-blank 'Tekla Bolt'.'Bolt Name' as part of the IFC record. This could be relatively easily adapted to other IFC object types, PSets, and properties by editing the string constants in the script. Procedure SelectByIFCProperty; {December 13, 2019} {© 2019 Patrick Stanford pat@coviana.com} {Licensed under the GNU Lesser General Public License} {Selects all objects that are defined as IFCMechanicalFastener } {and have an IFCPSet of Tekla Bolt with a non-blank Bolt Name attached.} {Here be dragons. No Warranty Expressed or Implied. Use at your own risk} Var B1:Boolean; S1,S2,S3,S4:String; N1:Integer; Procedure Execute(H1:Handle); Begin B1:=IFC_GetPSetProp(H1,S3,S4,S2,N1); If ((B1=True) & (S2<>'')) then SetSelect(H1); End; Begin S1:='Tekla Bolt.Bolt Name'; S3:=Substring(S1,'.',1); S4:=Substring(S1,'.',2); DSelectAll; ForEachObject(Execute,((IFC_ENTITY='IfcMechanicalFastener'))); End; Run(SelectByIFCProperty); 1 Quote Link to comment
WhoCanDo Posted July 2 Author Share Posted July 2 After all this time, I still can't get a reliable search happening. This code supposes this hierarchy .. IfcMechanicalFastener Tekla Bolt Bolt Name and it works well. However, I have a client that sent me an IFC file with this hierarchy .. IfcMechanicalFastener IfcMechanicalFastener Bolt Name and it doesn't work when I try and find the Bolt Name. Can someone suggest a reason please ? Procedure SelectByIFCProperty; {December 13, 2019} {© 2019 Patrick Stanford pat@coviana.com} {Licensed under the GNU Lesser General Public License} {Selects all objects that are defined as IFCMechanicalFastener } {and have an IFCPSet of Tekla Bolt with a non-blank Bolt Name attached.} {Here be dragons. No Warranty Expressed or Implied. Use at your own risk} Var B1:Boolean; S1,S2,S3,S4:String; N1:Integer; Procedure Execute(H1:Handle); Begin B1:=IFC_GetPSetProp(H1,S3,S4,S2,N1); If ((B1=True) & (S2<>'')) then SetSelect(H1); End; Begin S1:='Tekla Bolt.Bolt Name'; S3:=Substring(S1,'.',1); S4:=Substring(S1,'.',2); DSelectAll; ForEachObject(Execute,((IFC_ENTITY='IfcMechanicalFastener'))); End; Run(SelectByIFCProperty); Quote Link to comment
Pat Stanford Posted July 2 Share Posted July 2 Try changing the S1 line to: S1:='IFCMechanicalFastener.Bolt Name'; Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.