×
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

Can I sketch a symmetric rectangle in a single step?
3

Can I sketch a symmetric rectangle in a single step?

Can I sketch a symmetric rectangle in a single step?

(OP)
Is there an easy way to sketch a rectangle that will be centered and symmetric with the orgin?  I find myself defining this sketch quite often and I'm wondering is there's some kind of control-drag way of defining a rectangle that will make this a quicker process.

For reference, I currently sketch a rectangle and then sketch centerlines from the orgin to the midpoints of the top and right side.  I then define the center lines as vertical and horizontal.  I'd love to find a faster way.

-b

RE: Can I sketch a symmetric rectangle in a single step?

Yes, there is.  Read Help Topics about polygons.

"Art without engineering is dreaming; Engineering without art is calculating."

Have you read FAQ731-376: Eng-Tips.com Forum Policies to make the best use of Eng-Tips Forums?

RE: Can I sketch a symmetric rectangle in a single step?

(OP)
I don't think the polygon tool will do a rectangle, but that's the kind of funtionality I want.  FYI, I'm using 2007.

-b  

RE: Can I sketch a symmetric rectangle in a single step?

1. Sketch the rectangle.
2. Draw a single construction line from one corner to the opposite corner.
3. Place a point at the mid-point of the construction line.
4. Constrain that point to the origin.

  finisher SW 2007

RE: Can I sketch a symmetric rectangle in a single step?

Can you put a sketch in the Design Library?

RE: Can I sketch a symmetric rectangle in a single step?

Sorry bvanhiel. I read your post as "triangles"... I use the same method as finisher for rectangles and squares.

"Art without engineering is dreaming; Engineering without art is calculating."

Have you read FAQ731-376: Eng-Tips.com Forum Policies to make the best use of Eng-Tips Forums?

RE: Can I sketch a symmetric rectangle in a single step?

If using finisher's method, you don't need to place a point at the midpoint of your diagonal construction line - just put a midpoint constraint between the construction line and the origin.

RE: Can I sketch a symmetric rectangle in a single step?

I use:

CODE


Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim FeatureData As Object
Dim Feature As Object
Dim Component As Object
Sub main()

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc
Part.ClearSelection2 True
Part.SketchRectangle -0.03093212735166, 0.04488191027496, 0, 0.0511492040521, -0.02506917510854, 0, 1
Part.ClearSelection2 True
Part.CreateLine2(0.0511492040521, 0.04488191027496, 0, -0.03093212735166, -0.02506917510854, 0).ConstructionGeometry = True
Part.ClearSelection2 True
Part.SetPickMode
boolstatus = Part.Extension.SelectByID("Line5", "SKETCHSEGMENT", 0.01516280752533, 0.0141519536903, 0, False, 0, Nothing)
boolstatus = Part.Extension.SelectByID("Point1@Origin", "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing)
Part.SketchAddConstraints "sgATMIDDLE"
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID("Line5", "SKETCHSEGMENT", 0.01516280752533, 0.0141519536903, 0, False, 0, Nothing)
boolstatus = Part.Extension.SelectByID("Point1@Origin", "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing)
boolstatus = Part.Extension.SelectByID("Line2", "SKETCHSEGMENT", -0.03133646888567, 0.01051287988423, 0, False, 0, Nothing)
boolstatus = Part.Extension.SelectByID("Line1", "SKETCHSEGMENT", -0.01799319826339, 0.02587785817656, 0, True, 0, Nothing)
boolstatus = Part.Extension.SelectByID("Line4", "SKETCHSEGMENT", 0.03012344428365, 0.001213024602026, 0, True, 0, Nothing)
boolstatus = Part.Extension.SelectByID("Line3", "SKETCHSEGMENT", 0.01758885672938, -0.02466483357453, 0, True, 0, Nothing)
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID("Line1", "SKETCHSEGMENT", -0.009502026049204, 0.02709088277858, 0, False, 0, Nothing)
boolstatus = Part.Extension.SelectByID("Line2", "SKETCHSEGMENT", -0.03052778581766, 0.01293892908828, 0, True, 0, Nothing)
boolstatus = Part.Extension.SelectByID("Line3", "SKETCHSEGMENT", 0.01475846599132, -0.02709088277858, 0, True, 0, Nothing)
boolstatus = Part.Extension.SelectByID("Line4", "SKETCHSEGMENT", 0.02891041968162, -0.01051287988423, 0, True, 0, Nothing)
End Sub

Nothing but a recorded macro, not cleaned up or anything.

For the record, I think this is the crappiest macro I've ever posted here, but I use it all the time.  I have it mapped with a keyboard shortcut.

RE: Can I sketch a symmetric rectangle in a single step?

2008 has the best of all enhancements...(drum roll, please)...I give you...the Center Rectangle.  It's one of those enhancements that are actual time savers and should have been available from day 1.

Dan

www.eltronresearch.com

RE: Can I sketch a symmetric rectangle in a single step?

I use the same technique as dgowans.

Chris
SolidWorks/PDMWorks 08 2.0
AutoCAD 06/08
ctopher's home (updated 10-07-07)

RE: Can I sketch a symmetric rectangle in a single step?

I do it similar to finisher, except that I make the construction line midpoint to the top and bottom horizontal line.   This way, if I choose to put a fillet on the sketch I do not lose the constraints made on the corners and the construction line.   

That is also how the "rectangle" macro is done found on the CD of the Solidworks Bible.

Flores

RE: Can I sketch a symmetric rectangle in a single step?

Quote:

...this is the crappiest macro I've ever posted here

Function over form.  I'll use this quite often. Thanks.

Joe
SW Office 2006 SP5.1
P4 3.0Ghz 1GB
ATI FireGL X1

RE: Can I sketch a symmetric rectangle in a single step?

Another way to do it is without additional construction lines. Draw the rectangle with origin inside. Select midpoint of top line and control select origin and make vertical than midpoint of left line and origin and make horizontal.
Midpoint is selected by right clicking on the line and choosing from the menu.

RE: Can I sketch a symmetric rectangle in a single step?

I have a sketch in my design library for the symmetric rectangle.

Eric

RE: Can I sketch a symmetric rectangle in a single step?

SW2008 finally allows you to draw a rectangle by selecting a center point, so we no longer have to add construction lines as was previously required.

RE: Can I sketch a symmetric rectangle in a single step?

Crappy macro #2 (as recorded):

CODE

Dim swApp As Object
Dim Part As Object
Dim SelMgr As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim Feature As Object
Sub main()

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager

swApp.ActiveDoc.ActiveView.FrameState = 1
Part.ClearSelection2 True
Dim vSkLines As Variant
vSkLines = Part.SketchManager.CreateCornerRectangle(-0.07072414660869, -0.03687367058217, 0, 0.07599696221126, 0.04203082730694, 0)
Part.SetPickMode
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("Line3", "SKETCHSEGMENT", -0.009611839420063, 0.04228868514318, 0, False, 0, Nothing, 0)
Part.SelectMidpoint
boolstatus = Part.Extension.SelectByID2("Point1@Origin", "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
Part.SketchAddConstraints "sgVERTICALPOINTS2D"
Part.SketchAddConstraints "sgVERTICALPOINTS2D"
boolstatus = Part.Extension.SelectByID2("Line2", "SKETCHSEGMENT", -0.07356058280732, -2.578578362389E-04, 0, False, 0, Nothing, 0)
Part.SelectMidpoint
boolstatus = Part.Extension.SelectByID2("Point1@Origin", "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
Part.SketchAddConstraints "sgHORIZONTALPOINTS2D"
Part.SketchAddConstraints "sgHORIZONTALPOINTS2D"
Part.SetPickMode
Part.ClearSelection2 True
End Sub

RE: Can I sketch a symmetric rectangle in a single step?

Hey, Guys.  The macros are cool for earlier versions, but why not just use the center rectangle as I suggested for '08?  Am I missing something besides my hair?

Dan

www.eltronresearch.com

RE: Can I sketch a symmetric rectangle in a single step?

Yes.... lots of people haven't yet upgraded to 2008.

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