htranbos
Member-
Posts
29 -
Joined
-
Last visited
Reputation
3 NeutralPersonal Information
-
Location
United States
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
How to draw (lines or walls) parallel to another on the fly?
htranbos replied to MarCur's topic in General Discussion
This works for me. Thank you! -
Thanks Pat and Raymond!! In that case, I think the documentation is a bit misleading. Instead of saying FSActLayer & LSActLayer return the first and last SELECTED objects. It should say FSActLayer & LSActLayer return the first and last drawn objects in the document. Is there a function to return selected objects in order, depending on how each object is selected on screen?
-
Thanks so much Pat!
-
Hello, I have 2 rectangles in my document. According to VS Python documentation: - Function FSActLayer returns a handle to the first selected object on the active layer. - Function LSActLayer returns a handle to the last selected object on the active layer When I select the left object first and the right object second, I receive the following alerts (as shown in attached screenshot) However, when I change the order of selection, by selecting the right object first and the left object second, I still receive the same alert. Wouldn't h1 & h2 order change dynamically based on whether it is selected first or last? I hope my question makes sense. Thank you! h1 = vs.FSActLayer() h2 = vs.LSActLayer() vs.AlrtDialog(h1) vs.AlrtDialog(h2)
-
Hello all, I finally made it to work. In order for the above code to produce the correct result, you need to put each search criteria inside a () like below. crit_string_1 = "(SEL=TRUE) & (T=NURBSCURVE)"
-
@twk I tried your suggestion placing criteria strings in variables. Each method works and produced no error. However, the output is still 0 instead of 1. For this test, I only have 1 Nurbs curve object in the scene and it is selected. The output of this script should be 1 instead of 0. I don't know why I can't get it to produce the correct result. myList = [] def sel(h): myList.append(h) crit_string_1 = '"SEL=TRUE" & "T=NURBSCURVE"' vs.ForEachObject(sel, crit_string_1) vs.AlrtDialog('Number of selected objects: {}'.format(len(myList)))
-
Thanks @twk. I will try SEL and see if it the result is correct.
-
I am able to make the script run without any error message.... but the output of this code should be 1 not 0. I don't know what I did wrong. myList = [] def sel(h): myList.append(h) vs.ForEachObject(sel, "(T='NURBSCURVE') & (VSEL=TRUE)") vs.AlrtDialog('Number of selected objects: {}'.format(len(myList)))
-
It works if I break down the code like below: myList = [] def sel(h): myList.append(h) vs.ForEachObject(sel, "T=RECT") vs.ForEachObject(sel, "T=NURBSCURVE") vs.AlrtDialog('Number of selected objects: {}'.format(len(myList)))
-
Hi Pat, I tried your suggestion and got the following error message. I didn't know about the criteria builder inside VS editor. This is awesome. Thank you!!
-
I am making a simple python script to calculate the number of items added to a list. I have multiple rectangles and nurb curves in the scene. My script is below. According to VS:Search Criteria, multiple search criteria are created using the & operator to chain individual search criteria terms. However, I got the unsupported & operator error. Does anyone know how to perform multiple search criteria with Python script? Thanks fam! myList = [] def sel(h): myList.append(h) vs.ForEachObject(sel, "T=RECT" & "T=NURBSCURVE") vs.AlrtDialog('Number of selected objects: {}'.format(len(myList)))
-
@JBenghiat Finally I am able to make it to work. Below is what I did: h = vs.FSActLayer() upi = vs.GetPrefReal(152) #Calculate unit per inch preference thickness = 25.4*upi*2 #Converting mm to in (1in = 25.4mm). This statement set thickness to 2" vs.CreateShell(h, thickness)
-
@JBenghiat Thank you! I did not realize there is a separate forum for Python Scripting. I started to mess around with units per inch preference but haven't been able to make it to work. I will play around with it some more.