changing XYZ.X coordinates

changing XYZ.X coordinates

stanleypaseur
Contributor Contributor
1,602 Views
1 Reply
Message 1 of 2

changing XYZ.X coordinates

stanleypaseur
Contributor
Contributor

I have a loop in which I am trying to change a the x-coordinate. Below is a portion of my code. The insert.Pt is a point inside a loop that will need to have the x-coordinate changed with each iteration. I get the following error when compiling:

 

"Property or indexer 'Autodesk.Revit.DB.XYZ.X' cannot be assigned to -- it is read only (CS0200) - C:\ProgramData\Autodesk\Revit\Macros\2016\Structure\AppHookup\ConcBeamSchedule\Source\ConcBeamSchedule\ThisApplication.cs:167,8"

 

Autodesk.Revit.DB.XYZ originPt;
Autodesk.Revit.DB.XYZ insertPt;
originPt = Application.Create.NewXYZ(0.0, 0.0, 0.0);

insertPt.X=originPt;
insertPt.X=insertPt.X + 4/12;

 

Stanley

0 Likes
Accepted solutions (1)
1,603 Views
1 Reply
Reply (1)
Message 2 of 2

matthew_taylor
Advisor
Advisor
Accepted solution

Hi @stanleypaseur,

You need to re-create your XYZ each time.


Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?