Jump to content

Nurbs U & V changes


Cloud Hidden

Recommended Posts

If I use the OIP to change the Z value of individual vertices on a nurbs surface (it's a hemisphere I'm trying to flatten), the change is visible with each point I edit, and as I get through all the U's and V's, the object is flattened to the Z I want.

If I script the same thing...a loop through the U's and an inner loop through the V's with NurbsSetPt3D...all the vertices change, but the object is still drawn to the original elevation. I use DrawNurbsObject and Reset BBox and Set3DInfo, but with no obvious effect. Only after I click the "show vertices" box and the "reverse normal" box/button in the OIP a coupla times does the surface redraw properly. Strange. So what function is being called by the Reverse Normal button that I'm missing with NurbsSetPt3D?

Edit: One solution I just discovered is to use ConvertToNurbs to convert the modified surface to another, and that one is accurate. But I'm still curious what's happening and not happening.

[ 09-15-2003, 02:48 AM: Message edited by: Cloud Hidden ]

Link to comment
  • Vectorworks, Inc Employee

quote:

Originally posted by Cloud Hidden:

So what function is being called by the Reverse Normal button that I'm missing with NurbsSetPt3D?

Try calling the function RedrawAll. The reason for not triggering a redraw and bounds recomputation with every call to NurbsSetPt3D is that it can really slow things down for a complex surface with a few hundred points changing. If you're changing individual points through the object info palette, however, it's a lot slower than a VectorScript loop, so the full bounds recomputation and redrawing can be done.

Link to comment

Thank you. That's the one.

VS is making it a whooooooooooooole lot quicker for me to build some of the more complex dome shapes. Latest is an oblate spheroid on a stem wall with an inner shell. Several dozen steps along with some tricky mousing to reshape the nurbs, now reduced to a menu selection and a few dimensions in a dialog. Tr? cool! Thanks for your work on VS.

Link to comment
  • 4 weeks later...

Upon using the script further, it seems that RedrawAll does not cause the boundary recalc. What seems to make it redraw to match the 3D points is a solids operation, such as AddSolids (which I was adding coincidentally when I added the RedrawAll). Without the AddSolids, RedrawAll has no effect on the nurbs that I can see.

I simplified the script to show the problem. Run this with any diameter, and with a height less than D/2 and look at a side view. It draws as a hemi, but the vertices show the proper height.

Any ideas?

code:

Procedure Oblate;

VAR

pX, pY, pZ, cx, cy, cz : REAL;

hNurbs : HANDLE;

i, j :INTEGER;

BEGIN

DSelectAll;

cz := DistDialog('Dome Diameter:','0') / 2.0;

hnurbs := CreateHemisphere(cx, cy, 0.0, cx, cy, cz);

cz := cz / 1.4;

cz := DistDialog('New dome height:',Num2StrF(cz));

hnurbs := ConverttoNurbs(hNurbs, false);

Ungroup;

hNurbs:=FSActLayer; {select the base of the dome}

DelObject(hNurbs);

hNurbs:=FSActLayer; {select the dome}

i := 0;

while i < NurbsGetNumPts(hNurbs, 1) do begin

j := 0;

while j < NurbsGetNumPts(hNurbs, 0) do begin

NurbsGetPt3D (hNurbs, i, j, pX, pY, pZ);

if pz<> 0.0 then NurbsSetPt3D (hNurbs, i, j, pX, pY, cz);

j := j + 1;

end;

i := i + 1;

end;

RedrawAll;

END;

Run (Oblate);
[/code]

Link to comment

Cool...

Strange, when playing with the nurb surface on GL, I found that the closer I get to a top view the biger the hole I get on the middle of the shape??? draw a few more and he looks that if Height > Diameter the GL rendering have a problem. I don't have RW to try, but I wonder in witch cases the GL will let me down.

On a Dual 1.25 G4 OXS and plenty of ram.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...