Hi Everyone, I am very new at VB and with macro in SolidWorks. As I have stated in the title, I am trying to find a way to pull the radius of the bottle base (a part) and populated it in the user form or have it assigned to a variable so I can use it in calculation.
User Form V1.PNG shows the user form that I will be using to collect necessary data from the user. Currently, the user will have to manually measure the radius of the bottle in SolidWorks and input it in the userform. However, I would like to make it so that the user will not have to measure the radius, instead have the macro pull that data on its own and assign it to a variable so I can use it for calculation. I am really not sure, how to implement this or if there's a better method to go about this.
I apologize for the long writing but I wanted to make sure everyone understand what I am trying to get the macro to do. Thank you in advance. I really appreciate it.
6 2891
Combobox1 has "BASE 1" to "BASE 6" set, but Change() has no options other than "Bottele 1" to "Bottle 6".
If you don't unify them either, the program does nothing.
Hi, yes thank you for pointing that out, that was my mistake. Also thank you, your code helped me last time. Could you help me on how I could go about pulling the dimension from the bottle. Please let me know if you need more information from me.
Use the "text" property to display the value in the textbox.
Use the "value" property to reference the value in the textbox. - Public value As Double
-
-
Private Sub UserForm_Initialize()
-
With ComboBox1
-
.AddItem "Bottle 1"
-
.AddItem "Bottle 2"
-
.AddItem "Bottle 3"
-
.AddItem "Bottle 4"
-
.AddItem "Bottle 5"
-
.AddItem "Bottle 6"
-
End With
-
End Sub
-
-
Private Sub ComboBox1_Change()
-
Select Case ComboBox1.List(ComboBox1.ListIndex)
-
Case "Bottle 1"
-
value = 1.1
-
Case "Bottle 2"
-
value = 1.2
-
Case "Bottle 3"
-
value = 1.3
-
Case "Bottle 4"
-
value = 1.4
-
Case "Bottle 5"
-
value = 1.5
-
Case "Bottle 6"
-
value = 1.6
-
End Select
-
-
End Sub
-
-
Private Sub CalculateButton_Click()
-
AngleTextBox.Text = Math.Atn((CDate(RadiusTextBox.value) / CDate(HightTextBox.value)) * (180# / PI()) + value
-
End Sub
-
-
Function PI()
-
PI = 4# * Atn(1#)
-
End Function
So this would allow for me to reference the value from the part? How would the code know get which part of its body, in solidworks, I am wanting the dimension of? Would this not just grab the code from the text box?
I don't know how to get the data of SolidWorks.
You can think of it. And assign it as RadiusTextBox.text=XXXX and HightTextBox.text=XXXX in Combobox1_change() Fanction.
I just fixed a mistake in your code.
If the bottle geometry data is stored in the table and you want to retrieve it from the table, issue a query (Select statement).
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Andrew Dalke |
last post by:
Here's a proposed Q&A for the FAQ based on a couple recent
threads. Appropriate comments appreciated
X.Y: Why doesn't Python have macros like in Lisp or Scheme?
Before answering that, a...
|
by: Steve Jorgensen |
last post by:
Hi all,
I'm working on the schema for a database that must represent data about stock
& bond funds over time. My connundrum is that, for any of several dimension
fields, including the fund name...
|
by: Alexander Ulyanov |
last post by:
Hi all.
Is it possible to pass the whole blocks of code (possibly including
" and ,) as macro parameters?
I want to do something like:
MACRO(FOO, "Foo",
"return "Foobar";",
"foo();...
|
by: Garry Freemyer |
last post by:
I'm trying to convert this macro to a c# function but I have a big problem.
It's on the LEFT side of an assignment statement and I am extremely
flustered over this one because I'm a little rusty...
|
by: junky_fellow |
last post by:
Hi,
Are there any issues if I define a macro as follows:
#define MY_MACRO(a,b); my_function((a),(b));
and calling this macro as follows,
MY_MACRO(a,b);
|
by: Jimbo |
last post by:
Im trying to design my time dimension and need to add a field to
handle null dates in the fact. So if at the time of ETL the date isnt
known, referential integrity will be preserved. Kimball...
|
by: John Torres |
last post by:
I am trying to create a combo box search on the form with the Part Number but for some reason it’s pulling the Part Number Table’s Primary Key. Can’t figure out why. Any ideas where to start?
FYI-...
|
by: kesterson.al |
last post by:
solidworks crack
http://cracks.00bp.com
F
R
E
E
|
by: hollierfloanuu |
last post by:
solidworks 2008 crack
http://cracks.00bp.com
F
R
E
E
|
by: mahendra dubey |
last post by:
Hi there I have c# application that runs on both 32bit and 64 bit machine. In my app, I want to check whether solidworks is installed on computer or not. Can we check it ,by reading registry keys(for...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |