×
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

Solidworks Design Table

Solidworks Design Table

Solidworks Design Table

(OP)
Hello all,

I am looking for some help creating macros in excel/solid works. Let me give you a brief explanation of the project I was assigned, and what I am trying to do. One of our major product lines for the company I work for is machined plastic rings. We currently have ~1,000 different styles, with endless configurations in each style. The dimensions of the ring are based of equations. In most cases I will be imputing a cross section and I.D. dimension, which will drive the equations to create the ring. I just finished drawing all ~1,200 rings in solid works, and linked them to appreciate equations in excel. This is working great, however I was asked to create a button/macro in excel that will do the following.

Open/Save/Close the model and drawing, the model and drawing should be saved as the part number which is derived from the dimension of the part and is located in the cell label part number in excel. I created a example ring, for reference(See attached excel /solid works file). And to make it even more difficult, I need to destroy the link to the design table when it saves each part. Any help I could get would be greatly appreciated!

Thanks you,

David S.

RE: Solidworks Design Table

Why destroy the link to the spreadsheet, just do not save the changes.

--
Hardie "Crashj" Johnson
SW 2010 SP 2.1
HP Pavillion Elite HPE

 

RE: Solidworks Design Table

(OP)
When you save the drawing it still links back to the excel file.  The excel file will be continuously changing throughout the day as the designers make 100s of drawings a day, this could become a problem

.

RE: Solidworks Design Table

(OP)
Thanks for the response. I am now working with another engineer in my department on this. We decided it would be more beneficial if we wrote a macro for solidworks to make the drawings for us., so the everything would be scaled properly. He is working on linking our excel dimensions to a solidworks, by focing the dimensions from an excel document to a solidworks design tabel. And I am working on creating the drawing templates themselves. I have found various code on the internet, and compiled peices togther to create the code below. Let me tell you where I am stuck. I want the cross sectioned view to be twice as big as it is currently, so a custom sacle of 2:1. In addition, i want to import annotations(Design Annotations). However when I use the record macro function in solidworks, it does not reconize me doing this. Do you know the commands to...
1. change the scale of a view in a drawing. ?
2. turn on import annotations(design annotations)?


Sub main()

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

sOutputFolder = Left(swModel.GetPathName(), Len(swModel.GetPathName()) - Len(swModel.GetTitle()) - 7)

vConfs = swModel.GetConfigurationNames()

For i = 0 To UBound(vConfs)

Set swDraw = swApp.NewDocument(sDrTemplate, 0, 0, 0)

Dim swDrawModel As SldWorks.ModelDoc2

Set swDrawModel = swDraw

swDraw.InsertModelInPredefinedView swModel.GetPathName()

Set swView = swDraw.GetFirstView

While Not swView Is Nothing

swView.ReferencedConfiguration = vConfs(i)

Set swView = swView.GetNextView

Wend

swDrawModel.ForceRebuild3 False

swDraw.InsertModelAnnotations3 swImportModelItemsSource_e.swImportModelItemsFromEntireModel, 32776, False, True, False, False

Set Part = swApp.ActiveDoc
boolstatus = Part.ActivateView("Drawing View4")
boolstatus = Part.ActivateView("Drawing View5")
Dim skSegment As Object
Set skSegment = Part.SketchManager.CreateLine(0#, 0.03128, 0#, 0#, 0.05127, 0#)


Dim myView As Object
Dim excludedComponents As Variant
Set myView = Part.CreateSectionViewAt5(0.2062697090198, 0.1044204373142, 0, "B", 20, (excludedComponents), 0)
boolstatus = Part.ActivateView("Drawing View7")
Part.ClearSelection2 True
swDrawModel.Extension.SaveAs sOutputFolder + swModel.GetTitle() + "_" + vConfs(i) + ".slddrw", swSaveAsVersion_e.swSaveAsCurrentVersion, swSaveAsOptions_e.swSaveAsOptions_Silent, Nothing, 0, 0

swApp.CloseDoc swDrawModel.GetTitle()

Next

End Sub

Thanks again,

dAVID

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