Deleting or updating a line

Hi, how can I update the line end-position? On updating the end position, the lines are being aggregated to the scene as shown in fig. There are six such lines.

I want to update the end coordinates i.e. PH by moving the slider. A new line should be made, deleting old line…

var material, geometry1

function addline(PH){
	//line1
	material = new THREE.LineBasicMaterial( { color: 0x0000ff } );
	
	points1.push( new THREE.Vector3( PH[0][0], PH[0][1], PH[0][2] ) );
	points1.push( new THREE.Vector3( 104.80, 771.82, 0 ) );
	geometry1 = new THREE.BufferGeometry().setFromPoints( points1 );
	line1 = new THREE.Line( geometry1, material );
	sys.add(line1);
}

function clearline(){
	material.dispose();
	geometry1.dispose();
	sys.remove(line1);
}

Possibly you can take something from it?
Construction of frames with contour/profile

This example works with variable lines: ConstructFrame . The scene is redrawn when the lines are changed.

line 375 function redrawSceneA( ) { ...

line 817 function createLinesLR( ) { ...

line 857

function onContainerBmouseDown( event ) { 
		... ... ...
		gLineL.attributes.position.needsUpdate = true;
		redrawSceneA( );
		}

Also note in some places:
gLineR.attributes.position.needsUpdate = true;

(L left, R right)

Hi, can you please share the link to exact script file… I couldn’t find

If you search the web you will find

How to view the HTML source code of a web page

e.g.

Use it for ConstructFrame

or directly
view-source:https://hofk.de/main/threejs/ConstructFrame/ConstructFrame.html

Why so, if you can update the end vertex of a line? Edit fiddle - JSFiddle - Code Playground

inputRangeUpdateX

1 Like

thank you…