×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

user selectable dim in driven part

user selectable dim in driven part

user selectable dim in driven part

(OP)


SW 2003 SP3.1

I have a part that consists of a flange with a nipple.
The part is table driven and for the various sizes works fine.
However, I would like to have the nipple length variable.
Is it possible (easily possible) to require the person inserting the part to type in a dim valve for the nipple length when the part is inserted?

e.g.  User selects version of part he wants and a dialog pops up asking for nipple length.  
This would be useful.

Thanks in advance,
DG

RE: user selectable dim in driven part

You can have an assmebly DT and in the DT you can have a program the specifies certain parts. You would have to have all the parts pre-made. Then the DT would ask for a Size and you pick out out pre-made config of the nipple.

I'm not sure if this is what your looking for but here are some Examples of some of my previous work.

http://www.scottjbaugh.com/Design_Portfolio/SW%20Models%20DT.htm

These are small programs I wrote using DT and VBA

Also at the very bottom there is an article I wrote for  Solid Solutions about a year or 2 ago on VBA and SW

I hope that helps,

Scott Baugh, CSWP
3DVision Technologies
http://www.3dvisiontech.com
http://www.scottjbaugh.com
FAQ731-376
When in doubt, always check the help

RE: user selectable dim in driven part

(OP)
Thanks Scott for your response

Do you have to use VB or can you configure the design table to prompt user when her picks a model

Thanks again,
DG

RE: user selectable dim in driven part

Check out "Data Validation" in excel, or even consider using a library part, which can be made to pop up a prompt, as well.

RE: user selectable dim in driven part

I never used a lot of VB myself I used VBA which is lot like VB but yet totally different.

The above link that has those VBA programs and articles shows you how I accomplished what I was after. I'm hoping it might give you some insight on what your trying to do and if it's possible in VBA or if you think your going to have to use VB. It really depends on what your after and the way your assembly and parts are modeled.

I believe it's possible it's just a matter of figuring out which is the best way.

Be sure to DL and take these files apart from off my website:
VBA Controlled Box
DT Controlled Box
Excel Example
Solid Solutions - can't take this apart but it worth a read or summarize.

Best Regards,

Scott Baugh, CSWP
3DVision Technologies
http://www.3dvisiontech.com
http://www.scottjbaugh.com
FAQ731-376
When in doubt, always check the help

RE: user selectable dim in driven part

This is possible with VB...

You might try by recording a macro then using the VBA interface to add the dialog and customize it to the way you want...

To record a macro...

Start a fresh session of SW... (or just close your file)

Click Tools>Macro>Record

Open Your Part...

Modify the Dimensions you need to...

You Can Save the part if you want to (optional)

Then Stop the macro...
  1) on the Macro toolbar that pops up when you start recording
  2) Tools>Macro>Stop...
And Save The Macro to a (*.swp) file...

Now Click Tools>Macro>Edit...
And open the (*.swp) file you just saved...

It should look something like this...
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long
Dim Annotation As Object
Dim Gtol As Object
Dim DatumTag As Object
Dim FeatureData As Object
Dim Feature As Object
Dim Component As Object

Sub main()
  Set swApp = CreateObject("SldWorks.Application")
  Set Part = swApp.ActiveDoc
  swApp.ActiveDoc.ActiveView.FrameState = 1
  swApp.LoadFile2 "C:\Documents and Settings\hbb3336\My Documents\Sldworks_Local\Hole Ex 1.SLDPRT", ""
  Set Part = swApp.ActiveDoc
  Set Part = swApp.OpenDoc4("C:\TEST 1.SLDPRT", 1, 0, "", longstatus)
  swApp.ActiveDoc.ActiveView.FrameLeft = 0
  swApp.ActiveDoc.ActiveView.FrameTop = 0
  swApp.ActiveDoc.ActiveView.FrameState = 1
  Set Part = swApp.ActivateDoc("Hole Ex 1.SLDPRT")
  swApp.ActiveDoc.ActiveView.FrameState = 1
  Part.SelectByID "Base-Extrude", "BODYFEATURE", 0, 0, 0
  Part.ActivateSelectedFeature
  Part.SelectByID "D1@Base-Extrude@Hole Ex 1.SLDPRT", "DIMENSION", 0.1207237397398, 0.02583015579621, -0.05764969775036
  Part.Parameter("D1@Base-Extrude").SystemValue = 0.1778
  Part.ClearSelection
  Part.EditRebuild
  Part.SaveAs2 "C:\TEST 2.SLDPRT", 0, False, False
  Part.Save2 False
End Sub


Notes:
This Opens the document...
  Set Part = swApp.OpenDoc4("C:\TEST 1.SLDPRT", 1, 0, "", longstatus)
This Selects the Feature You Selected...
  Part.SelectByID "Base-Extrude", "BODYFEATURE", 0, 0, 0
This Activates the Selected Feature...
  Part.ActivateSelectedFeature
This Selects the Dimension You Selected...
  Part.SelectByID "D1@Base-Extrude@Hole Ex 1.SLDPRT", "DIMENSION", 0.1207237397398, 0.02583015579621, -0.05764969775036
This Sets the Value For the selected Dim...
  Part.Parameter("D1@Base-Extrude").SystemValue = 0.1778
*NOTE* ALL VALUES IN SW VBA MUST BE METRIC and/or CONVERTED TO METRIC
This Saves the document with a New Name...
  Part.SaveAs2 "C:\TEST 2.SLDPRT", 0, False, False
This Saves the document With The Current Name...
  Part.Save2 False

Let Me Know if you need further Help with the VB side...
Hope This Helps, Good Luck

Thanks,
--Josh--

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources