What's new

VB.Net API Development

ruesve

Member
Hello Everybody,

I'm trying to develope an addon for Alibre Design in VB.Net

I tried it with the manual wich has been delivered with Alibre Design and with entry's on this Forum.

I get the same error over time and time with or without debugging:

OKIggBW.png


Wich is translated like this: "The File or Assembly "AlibreX, Version=1.0.0.00 Culture=neutral, OublicKeyToken=numm" or a reference can't be found" It has tried to load a file with a wrong format.


I got the Code from a forum post and my code just looks like this:

Code:
Private Sub btn_createobject_Click(sender As Object, e As EventArgs) Handles btn_createobject.Click
        Dim p() As Process
        p = Process.GetProcessesByName("Alibre Design")


        If p.Count > 0 Then 'check if the task Alibre Design is running'
            'if yes
            Dim hook As AlibreX.AutomationHook = GetObject(, "AlibreX.AutomationHook")
            Dim root As IADRoot = hook.Root
            Dim partSession As IADPartSession = root.CreateEmptyPart("Simple Part", False)
            Dim designSession As IADDesignSession = partSession
            Dim session As IADSession = partSession
            Dim designPts As IADDesignPoints = designSession.DesignPoints

            Dim planes As IADDesignPlanes = designSession.DesignPlanes
            Dim XYPlane As IADDesignPlane = planes.Item("XY-Plane")
            Dim axes As IADDesignAxes = designSession.DesignAxes
            Dim Xaxis As IADDesignAxis = axes.Item("X-Axis")

            Dim plane10 As IADDesignPlane = planes.CreateAtOffsetToPlane(Nothing, XYPlane, 10.0, "Plane Offset At 10 cm")

            Dim sketch10 As IADSketch = partSession.Sketches.AddSketch(Nothing, plane10, "Sketch 10")

            sketch10.BeginChange()
            sketch10.Figures.AddCircle(3.0, 4.0, 1.0)
            sketch10.EndChange()

            Dim geoFactory As IADGeometryFactory = session.GeometryFactory

            Dim refPt0 As IADDesignPoint = designPts.CreatePoint(1.2, 2.3, 4.4, "Ref Pt. 0")
            Dim refPt1 As IADDesignPoint = designPts.CreatePoint(3.2, 4.3, -4.4, "Ref Pt. 1")

            Dim pt0 As IADPoint = geoFactory.CreatePoint(2.5, 1.3, 2.4)
            Dim pt1 As IADPoint = geoFactory.CreatePoint(3.2, 2.0, 3.3)

            Dim sketch3D As IAD3DSketch = partSession.Sketches3D.Add3DSketch("Sketch 3D")
            Dim spline3DPts As Double() = {1.0, 0.0, 0.0, 0.0, 1.5, 1.0, -2.0, 0.0, 3.0, 0.0, -2.0, 6.0}
            sketch3D.BeginChange()
            Dim spline3D As AlibreX.IAD3DSketchBspline = sketch3D.Figures.AddBsplineByInterpolation(spline3DPts)
            sketch3D.EndChange()

            Dim extrusion As IADExtrusionFeature = partSession.Features.AddExtrudedBoss(
                sketch10, 2.0, ADPartFeatureEndCondition.AD_TO_DEPTH,
                Nothing, Nothing, 0, ADDirectionType.AD_ALONG_NORMAL,
                Nothing, Nothing, True, 0, False, "New Cylinder",
                "Length of Cylinder", Nothing
            )

        Else
            'if no
        End If




    End Sub



I don't get it what i did wrong with copy paste from a forum.

(This is just an existing example. I'm still learning how to code an addon for AD, but therefor i ahve to learn it, and with an old manual its lot harder)


//EDIT 09.10.2017 14:25 GMT+1
Software: Visual Studio 2017 Enterprise 64 Bit
Windows 10 64 Bit

Thank you very much for your help.

Best Regards,
Sven
 
Last edited:

ruesve

Member
this problem is outdated and a solution has already been found. Therefore this thread can be closed.
 
Top