How to set a position of child, by XML formula, but able to be click and drag in 3D model?

Hello

How to set a position of DC child, by XML formula, but able to be click and drag on 3D model, without interference from formula?

I’m here with some problems involving XML formula

I’m using xml to import DC children. In this example, I need that spaces in Z axis (Z position), obey the formula bellow:

= space+(space*Copy)

so, the shelves will be spaced corretly. BUT, I need the Z attribute FREE, able to slide when I click and drag with mouse in Z axis. To make this, I’m removing of XML, “_z_formula” and changed to a simple “z” (removing “_underlines” and “formula” of properties )

in other attributes, this works and I can edit manually the value.

But this time 2 error occour:

1 - the formula is applying in just COPY 1 - the 2, 3 ,4 … is overlayed in Original DC ( is like not reading the copy>1 )
2 - this works just if I put formula in DC Z position directly, but this disable the slide with mouse

I tried create attribute in DC, with this formula, and call via XML,
I tried create a attribute by XML

summing up: I need this formula in XML to the shelves to be set in correctly place in Z positon, but the shelf needs be able to slide in Z when I click and drag (the formula in XML is to do the piece and your copies set spaced and not overlayed)

So, what’s wrong? Can I simply delete “_z_formula” and switch to “z”, or is another code notation?

tks a lot




You can add a drop-down on the DC to select current or the nominated.

free or fixed copies.skp (49.8 KB)

note: if using centimetres with CURRENT formula need to multiply result by 2.54 as it returns inches

1 Like

Hi @pcmoor

thanks for awnser.

is missing something, cause is showing this error.

But, if I understand what you wrote, you are sugesting a option in a list to make the calcules in Parametric mode (calling a formula) and Free to not call the formula, rigth?

I can’t do that in my example, because I’m setting the quantity of shelves in Parent! and I dont wanna select in a list too, cause the solution that i’m looking for, is let to the final user (the projectists), an construction more easy, just with mouse clicks and movement (without write, or select in lists, cause this envolves calculate the spaces, for example, and with mouse, the magnetc snap does the job).

So my first idea, is to write in XML the formula of the spaces, as if it were *parametric option (spaces=totalspace/numberOfShelves), but free of _formula (able to click and drag).

Is not working, and I don’t know why the formula is gray in original and copy 2, and fixed in copy 1 :man_shrugging:

I’ll make more test now and update here what is going on soon

thank so much for patience

Update:

this is happening:

Original Shelf: correct place and free (able to click and drag)
Copy=1: Correct place, but fixed in position (enable to click and drag)
copy=2:

wrong position, overlayed, but free to click and drag

the formula of Z position is:
spacefinal =space+(space*Copy)

where space =
=( ( Parent!LenZ-((Parent!NumberOfSpaces-1)*Thickness) ) / (Parent!NumberOfSpaces))+Thickness

and XML calls SpaceFinal (espaco2)