SOLVESPACE -- parametric 2d/3d CAD
Examples
Tutorials
Features
Download
Reference
Technology
Library
Forum
Contact
USER FORUM

(you are viewing a thread; or go back to list of threads)

Problem with Vertical Constraint (by Tom Sato)
Hello,

I'm experimenting with the dll and I've created a very simple experiment:

Added 2 points (Point1 and Point2)
Added Segment defined by Point1 and Point2
Add Vertical Constraint for Segment

I am able to move Point2 horizontally and the entire line is dragged maintaining the vertical constraint.

However, I can't seem to move Point1 the same way. It moves vertically, but it refuses to move horizontally.

When I try this in the SolveSpace application, it works just fine, but not in my app which relies on the dll. It's such a simple implementation, but I seem to be missing something. Any help would be greatly appreciated.

Thanks,
Tom
Sun May 24 2015, 10:42:58
(no subject) (by Jonathan Westhues)
Are you sure you're setting sys.dragged[] correctly? That will determine which parameters are left (as much as possible) at their initial values.
Sun May 24 2015, 13:17:21
(no subject) (by Tom Sato)
Many thanks for your input.

I created a very simple test and it works fine. There must be something wrong with my implementation. Here's the simplte test:

Dim Origin As Point3d = NewPoint3d(g, 0.0, 0.0, 0.0)
Dim Normal As Normal3d = NewNormal3d(g, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0)
Dim WP As Workplane = NewWorkplane(g, Origin, Normal)

Dim P1 As Point2d = NewPoint2d(g, WP, 0.0, 0.0)
Dim P2 As Point2d = NewPoint2d(g, WP, 0.1, 1.0)
Dim S1 As LineSegment = NewLineSegment(g, WP, P1, P2)
AddConstraintVertical(1, g, WP, S1.H)
Solve(g, P2, True)

Debug.WriteLine(P1.GetU & " " & P1.GetV)
Debug.WriteLine(P2.GetU & " " & P2.GetV)

By setting Drag0 to p1 or p2, GetU would be 0.0 or 0.1, which's the desired behavior. I'll trouble shoot my code to see what I'm doing wrong.
Sun May 24 2015, 16:59:53
(no subject) (by Tom Sato)
I found the problem. It was due to my misunderstanding of the meaning of the dragged0..dragged3 parameters. I thought each was a entityID (so I used the first and ignored the rest) when in fact they are param ids. Teaches me to read the documentation (and comments) better. Many thanks.
Sun May 24 2015, 17:44:24
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):
© 2008-2018 SolveSpace contributors. Most recent update Nov 22 2018.