xBimTeam / XbimSamples

Code examples. Most of these examples are described and explained on our website.
https://xbimteam.github.io/
33 stars 31 forks source link

Example request #6

Closed johnnyontheweb closed 7 years ago

johnnyontheweb commented 7 years ago

Dear all, I need to add an IfcBeam with a transversal section from an IfcArbitraryClosedProfileDef, which uses IfcCurve. Unfortunately, there's no example over the Internet on how to write in code an IfcCurve. I'm using vb.net and I tried this, but without success:

` Dim sect = imodel.Instances.[New](Of IfcArbitraryClosedProfileDef)()

                sect.ProfileType = IfcProfileTypeEnum.CURVE

                sect.ProfileName = "SectName"

                Dim curve = imodel.Instances.[New](Of IfcCurve)()

                ' how to insert points of the curve?

                sect.OuterCurve = curve

                ' cannot set position, not a member of IfcArbitraryClosedProfileDef

                ' sect.Position = imodel.Instances.[New](Of IfcAxis2Placement2D)()

                ' sect.Position.Location = ins`

I have also further doubts, because IfcCurve is not inheriting XBim.Common.InstantiableEntity ...

Can you help on that? Thanks

CBenghi commented 7 years ago

Hello, if you have a look at the specs of IfcCurve you'll see it's an abstract class; therefore it cannot be instantiated. You have to use of its subclasses (e.g. IfcPolyline) instead.

johnnyontheweb commented 7 years ago

Thanks for the reply, but there are 2 issues before that one in the code I posted:

  1. IfcArbitraryClosedProfileDef doesn't accept any ".Position" or ".Position.Location" attributes. What do I have to use to get the same object behaviour as IfcRectangleProfileDef?

  2. by using this code for the profile: Dim sez = imodel.Instances.[New](Of IfcRectangleProfileDef)() sez.ProfileType = IfcProfileTypeEnum.AREA sez.XDim = modelInE.sects(ee.sect).Lx sez.YDim = modelInE.sects(ee.sect).Ly sez.Position = imodel.Instances.[New](Of IfcAxis2Placement2D)() sez.Position.Location = ins where "ins" is an IfcCartesianPoint, I get always a profile drawn in the XY plane (so it's ok for vertical beams and columns, but not for horizontal beams). How to avoid this?

thanks

CBenghi commented 7 years ago

Hello, you can see how the orientation is set in the attached example. Best, Claudio

TwoColumsOneBeam.zip

johnnyontheweb commented 7 years ago

SOLVED It was a problem related to the local axis convention. In my case the following lone solved the problem: body.ExtrudedDirection.SetXYZ(0, 0, -1) Thanks anynway

ps. IMHO some detailed examples on beams and columns are still necessary.

CBenghi commented 7 years ago

Thanks Johnny, you are right, they are needed, I just had not find the time yet.