Jump to content
Developer Wiki and Function Reference Links ×

Custom Search IFC records


WhoCanDo

Recommended Posts

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

Link to comment

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

Link to comment

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);
	

 

  • Like 1
Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...