-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
polyline only vertices ? #106
Comments
Yes it should be possible, you need to add the polyline to the DB, not the vertices However there is a bug, and you'll have to wait for #107 before it actually works |
thank you, I will wait |
The plugin installer has been updated |
Hi tmontaigu, I just wanted to express my sincere gratitude for your prompt response and the update to the plugin installer. I have checked, and everything is now working perfectly. Thank you for your support and for addressing the issue so quickly. Your assistance is greatly appreciated! Best regards, |
Thanks 🤗 |
hi tmontaigu
i have a question, in the code example below, i noticed that once the polyline is generated only the vertices are visible for it, can the geometry of the segments joining the various vertices also be generated ?
thank you
import pycc
import cccorelib
CC = pycc.GetInstance()
pc_to_crop = CC.getSelectedEntities()[0]
bbMin, bbMax = cccorelib.CCVector3(), cccorelib.CCVector3()
pc_to_crop.getBoundingBox(bbMin, bbMax)
print(f"Min {bbMin}, Max: {bbMax}")
diag = bbMax - bbMin
bbMin = bbMin + cccorelib.CCVector3(diag.x / 2, 0, 0)
vertices = pycc.ccPointCloud()
vertices.setName("polyline.vertices")
vertices.addPoint(bbMin)
vertices.addPoint(bbMin + cccorelib.CCVector3(0, diag.y / 2, 0))
vertices.addPoint(bbMin + cccorelib.CCVector3(diag.x / 2, diag.y / 2, 0))
vertices.addPoint(bbMin + cccorelib.CCVector3(diag.x / 2, 0, 0))
polyline = pycc.ccPolyline(vertices)
polyline.setClosed(True)
This is important, otherwise the polyline would have a size of 0
polyline.addPointIndex(0, vertices.size())
#To see the crop area
CC.addToDB(vertices)
cropped_ref = pc_to_crop.crop2D(polyline, 2, True)
if cropped_ref is None:
raise RuntimeError("Failed to crop")
if cropped_ref.size() != 0:
cropped = pc_to_crop.partialClone(cropped_ref)
CC.addToDB(cropped)
else:
print("No points fall in crop area")
The text was updated successfully, but these errors were encountered: