Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5745

GetSettings in Python

$
0
0

@Ncik wrote:

G’day everyone,

Fair cop, I’m trying to translate/pilfer Dale Fugier’s steel section script from rhinoscript to rhinopython.

But GetSettings is giving me grief.

import rhinoscriptsyntax as rs
import scriptcontext
import Rhino

#**************************
# Draws Flat Bar sections
#**************************
def FlatBars():
    
    cmdname="Flat Bar"
    configfile="AllySections.ini"
    section="FLAT_BAR"
    
    filename=rs.FindFile(configfile)
    if not filename:
        msg=("Unable to locate " + configfile + ".")
        rs.MessageBox(msg, 16, cmdname)
        return
    
    
    entries=rs.GetSettings(filename, section)
    if not entries: return

entries=rs.GetSettings(filename,section) keeps giving the errors
"No section: ‘flat_bar’ "

Yet the ini file has this on the first line…
[FLAT_BAR]
;,
50x6 = 50.0,6.0

The help file sugggests there should be no issues with case sensitivity, but I have them as all caps anyway.

In SaveSettings there’s talk of a windows cache keeping the most recently accessed file around. Could this be the problem? If I delete the ini file it cannot be found, so don’t think this is the problem.

Any other thoughts?
cheers,
Nick

steel.ini (3.5 KB) steel.rvb (10.7 KB)

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5745

Trending Articles