AnsweredAssumed Answered

VB.NET AddIn - How to insert a sub to convert the unit, How to deal with small values?

Question asked by Ross John on Mar 25, 2017
Latest reply on Mar 26, 2017 by Amen Allah Jlili

I am new to this forum and I am looking forward to learn from you experts.


Also I am new to VB.NET and cannot solve these two problems on my own.


Question 1: I have wrote some codes to convert the unit from meter into millimeter. But I dont know how to use these codes in VB.NET AddIn. Here is my code:


Private Function convertMeterToMillimeter(Meter As Double)

    convertMeterToMillimeter = Meter / 1000

End Function


I want to insert the above code into the standard VB.NET AddIn codes, so that I can use this Function for all the other Subs in one project.


For example: In the standard VB.NET AddIn file there is a line like this: (In the Sub CreateCube)

     model.SketchRectangle(0, 0, 0, 0.1, 0.1, 0.1, False)


I want to rewrite the above line into something like this...:






                                             convertMeterToMillimeter(100), False)


Could anybody please tell me, where exactly should I put the Function convertMeterToMillimeter, how to make the declarations... etc.


Question 2: Besides, if there are small values, it seems SolidWorks cannot do correctly.


For example: If I change 100mm into 1mm in the standard VB.NET AddIn file:

From: model.SketchRectangle(0, 0, 0, 0.1, 0.1, 0.1, False)

Change to: model.SketchRectangle(0, 0, 0, 0.001, 0.001, 0.001, False)

SolidWorks will not do the job.


How to solve this problem?


Thanks for your help!