Column Location Mark get Grid

I want to get the grild from Column Location Mark?

example: 2(-2400)-7(2300) => list = [2,7]
2(2400)-7(-2300) => list = [2,7]
2(2400)-7(2300) => list = [2,7]
2-7(2300) => list = [2,7]
2(-2400)-7 => list = [2,7]

Where are you struggling?

Show your graph please

1 Like

get grild by column location mark.dyn (5.7 KB)

1 Like

ok, so you are able to get the location mark at all :smiley:

You’ll need a more flexible filter to get to the values you want since quite a few stringvalues are possible.

I’d say: regex

Still learning regex / python but I think you are looking for something like this.

# Enable Python support and load DesignScript library
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

import re
regex = re.compile("^([a-zA-Z0-9]*)(\(.*\))?-([a-zA-Z0-9]*)(\(.*\))?")

input = IN[0]
output = [] 

if not isinstance(input, list): 
	input = [input]


for i in input:
	if re.match(regex, i):
		ilist = []
		t = re.findall(regex, i)	
		ilist.append(t[0][0])	
		ilist.append(t[0][2])
		output.append(ilist)
	else: 
		output.append("no match found")

OUT = output
4 Likes

Thank you!