API help for Setting Hatch pattern

Discussion in 'SolidWorks' started by Chris Dubea, Sep 3, 2003.

  1. Chris Dubea

    Chris Dubea Guest

    Hi there,

    I'm tweaking my Custom Property gizmo that I have been developing for
    what seems like years now and have run into a roadblock.

    I'm trying to set the hatch pattern using the command

    RetVal = Part.SetUserPreferenceStringValue(swMaterialPropertyCrosshatchPattern,
    hatch)

    When I execute this I get a false in return in RetVal. This works in
    VBA, but not in VB. I've got everything else working, I can read and
    set density, but not the hatch pattern.

    The odd part is when I attempt to read the existing hatch pattern, I
    get an empty result.

    Is there a secret here or is this non-functional?

    Oh, I'm using Swx 2003 SP3.1

    Cheers,

    Chris
     
    Chris Dubea, Sep 3, 2003
    #1
  2. Chris Dubea

    Chris Dubea Guest

    Just a follow up. I got it to work. It doesn't like the word hatch
    used as a variable, and I had a space in the hatch name.

    Thanks anyway,

    CD
     
    Chris Dubea, Sep 3, 2003
    #2
  3. Chris Dubea

    Craig T Guest

    Check that swMaterialPropertyCrosshatchPattern = 13,

    I've used the following line without problems in 2001 through to 2003 sp4

    retval = Part.SetUserPreferenceStringValue(13, matprops(Material.ListIndex).crs)

    matprops is an array of text values that contains the cross hatch pattern names
    i.e "ISO (Aluminum)"

    Cheers
    Craig
     
    Craig T, Sep 3, 2003
    #3
  4. Chris Dubea

    Tony O'Hara Guest

    Try
    For Materials
    RetVal(1) =
    swModel.GetUserPreferenceDoubleValue(swMaterialPropertyCrosshatchScale)
    RetVal(2) =
    swModel.GetUserPreferenceDoubleValue(swMaterialPropertyCrosshatchAngle)
    RetVal(3) =
    swModel.GetUserPreferenceStringValue(swMaterialPropertyCrosshatchPattern)

    For Views
    RetVal(4) = swApp.GetUserPreferenceDoubleValue(swDrawingAreaHatchScale)
    RetVal(5) = swApp.GetUserPreferenceDoubleValue(swDrawingAreaHatchAngle)
    RetVal(6) = swApp.GetUserPreferenceStringValue(swDrawingAreaHatchPattern)
     
    Tony O'Hara, Sep 4, 2003
    #4
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.