GDL
About building parametric objects with GDL.
SOLVED!

Stretch object from center

A_ Smith
Expert

Does anybody knows is it possible to combine object stretching "ways" when object's origin located at center, not on the edge?

 

1. HS align to any element that already is placed. To do so additional parameter and IF statement in Parameter script was added.

2. Drag HS and manually enter value.

 

It seems like each path exclude other. Ideally 2nd one would work, but unfortunately HS can't be align properly to others element.

 

object

AC 22, 24 | Win 10
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Lingwisyer
Guru

You need to use a intermediate parameter which is half of your overall width. You then associate your hotspots to this parameter.

 

 

IF GLOB_MODPAR_NAME = "B" then
	A = 2 * B
	PARAMETERS A = A
endIF

IF GLOB_MODPAR_NAME = "A" then
	B = A/2
	PARAMETERS B = B
endIF

HOTSPOT2	0,		0,	unID,	B,	1		:	unID = unID + 1
HOTSPOT2	-A/2,	0,	unID,	B,	2,	A	:	unID = unID + 1
HOTSPOT2	A,		0,	unID,	B,	3		:	unID = unID + 1

HOTSPOT2	0,		0,	unID,	B,	1		:	unID = unID + 1
HOTSPOT2	A/2,	0,	unID,	B,	2,	A	:	unID = unID + 1
HOTSPOT2	-A/2,	0,	unID,	B,	3		:	unID = unID + 1

LINE2		-A/2,	0,	A/2,	0

 

 

Ling.

 

ps. Did not see object.

pss. Ah, you have basically done the same thing. You just need another GLOB_MODPAR_NAME for when you edit Length. THOUGH, I do not think you should be defining your hotspot positions using your intermediate parameter as that may cause issues down the line if you have other variables that modifiy Length as those actions will not proc GLOB_MODPAR_NAME given they are not direct intervention.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win10 | R5 2600 | 16GB | GTX1660 

View solution in original post

2 REPLIES 2
Solution
Lingwisyer
Guru

You need to use a intermediate parameter which is half of your overall width. You then associate your hotspots to this parameter.

 

 

IF GLOB_MODPAR_NAME = "B" then
	A = 2 * B
	PARAMETERS A = A
endIF

IF GLOB_MODPAR_NAME = "A" then
	B = A/2
	PARAMETERS B = B
endIF

HOTSPOT2	0,		0,	unID,	B,	1		:	unID = unID + 1
HOTSPOT2	-A/2,	0,	unID,	B,	2,	A	:	unID = unID + 1
HOTSPOT2	A,		0,	unID,	B,	3		:	unID = unID + 1

HOTSPOT2	0,		0,	unID,	B,	1		:	unID = unID + 1
HOTSPOT2	A/2,	0,	unID,	B,	2,	A	:	unID = unID + 1
HOTSPOT2	-A/2,	0,	unID,	B,	3		:	unID = unID + 1

LINE2		-A/2,	0,	A/2,	0

 

 

Ling.

 

ps. Did not see object.

pss. Ah, you have basically done the same thing. You just need another GLOB_MODPAR_NAME for when you edit Length. THOUGH, I do not think you should be defining your hotspot positions using your intermediate parameter as that may cause issues down the line if you have other variables that modifiy Length as those actions will not proc GLOB_MODPAR_NAME given they are not direct intervention.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win10 | R5 2600 | 16GB | GTX1660 

Thanks

Good point, it was not wise to use intermediate parameter for defying HS position.

TBH I haven't wrote another condition (for changing intermediate parameter if original is changed), because i thought that would alter HS position, but not object length when entering distance value manually

AC 22, 24 | Win 10