Help - dimensioning a sketched line in a drawing view

Discussion in 'SolidWorks' started by What-a-Tool, Jun 26, 2005.

  1. What-a-Tool

    What-a-Tool Guest

    Sketched a line in a drawing view:

    Dim swLine1 As SketchSegment
    Set swLine1 = swDraw.CreateLine2(sngLft, sngTop, 0, sngRght, sngTop, 0)

    Trying to dimension it now:

    blnRetVal = swLine1.Select4(True, swSelData)
    Set swDim = swDraw.AddDimension2(sngXText, sngYTxt, 0)

    When I hit the swDraw.AddDimension2 line, everything just locks up.
    What am I doing wrong here?

    Thanxs -

    --

    / Sean Mc /


    "I have not failed. I've just found 10,000 ways that won't work."
    - Thomas Alva Edison (1847-1931)
     
    What-a-Tool, Jun 26, 2005
    #1
  2. What-a-Tool

    Brian Guest

    I'll give this one a shot, although I'm not exactly an api knowlegeable
    person.

    Looks as though you are setting the annotation position but failing to give
    it a value. The test macro that I ran sets this by a line following your
    second dimensioning line by one that looks like this:
    Part.Parameter("D1@Sketch1").SystemValue = 0.0379683
    the api might be hanging because its waiting for the value. Do remember
    that the api runs in meters and may need conversion.
     
    Brian, Jun 27, 2005
    #2
  3. What-a-Tool

    What-a-Tool Guest

    This selects the line I just created:
    blnRetVal = swLine1.Select4(True, swSelData)

    This dimensions the selected object (The only reference required is that the
    object you want dimensioned is selected.):
    Set swDim = swDraw.AddDimension2(sngXText, sngYTxt, 0)

    What I am doing is determining the size of my part as my drawing is created,
    and drawing a boundind box around my part in each seperate view, in a
    seperate layer. I am then dimensioning the 3 axis' of this bounding box,
    also on this hidden layer.

    My problem (just discovered) : I was running SW invisibly, and when my
    dimension was created, the dimension's approve/change dialog box was not
    visible, and my code coudn't progress until I did something about this
    dialog I couldn't see.

    What I want is to create a driven dimension, so I won't have to deal with
    this dialog.
    I can't find anything in the API for doing this. Changing the driven state
    of an already created dimension, yes - creating as driven, No. I can create
    a non-associated dimension, but thats not really what I want.

    Can anyone give me a pointer in the right direction (creating a driven
    dimension)?

    By the way - thanks for the reply, Brian
     
    What-a-Tool, Jun 27, 2005
    #3
  4. What-a-Tool

    Brian Guest

    Try this maybe. Tools-system options-general-clear the "input dimension
    value" checkbox and the sketch-"prompt to set driven state" box also. The
    macro should then funtion (eliminates the spin box from the dimensioning
    process). That will create driving dimensions for those lines that are not
    fully defined and driven for those that are.
    If that is not what you are after then you can toggle the system
    preferences values from within a macro and back again once the dimensioning
    is done. Can also toggle the state of the dimension from driving to driven
    if, for some reason, you wanted to leave them as driven. I don't see a way
    to create a driven dimension directly if the object is not fully defined
    already. Seems as though you have to create it as a driving then toggle its
    state.

    Brian Hokanson
    Starting Line Products
     
    Brian, Jun 27, 2005
    #4
  5. What-a-Tool

    What-a-Tool Guest

    Even with those options un-checked, I am still having the same thing happen
     
    What-a-Tool, Jun 27, 2005
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.